Try the following, in order:
Smaller buffer size. Writing ~2 MiB at a time might be a good start. On my last laptop, ~512 KiB was the sweet spot, but I haven't tested on my SSD yet.
Note: I've noticed that very large buffers tend to decrease performance. I've noticed speed losses with using 16-MiB buffers instead of 512-KiB buffers before.
Use _open
(or _topen
if you want to be Windows-correct) to open the file, then use _write
. This will probably avoid a lot of buffering, but it's not certain to.
Using Windows-specific functions like CreateFile
and WriteFile
. That will avoid any buffering in the standard library.