Writing multiple files is slower than writing one big file.

So I'm making a tool which is dumping a ton images onto the disk and it was going slower than I expected. So just for kicks I tried creating just one file and dumping all the images into that and it was around 10 to 15 times faster (from 50 files/second to data more than 500 "files worth of data"/second).

So I'm wondering if that is a normal cost of file creation or if there's an alternative way to speed things up? Say if I knew how much space the files would be taking or something.

Currently, I'm using the File.WriteAllBytes() api.

by MacrosInHisSleep via /r/csharp

Leave a Reply