Chris, our friend at Computer Audiophile, is working on an article about wireless networking. He was having problems getting 192kHz FLAC files to play nicely over the wireless network using MC.
He helped do a bunch of tests, and what we learned is that reading from a file over the wireless network in small packets was orders of magnitude slower than reading with larger packets.
I was surprised by the result, because one of the basic jobs of the operating system is to provide an intelligent caching layer for file I/O. You might expect a small performance improvement by changing read block sizes, but I would not expect large differences (unless you were doing something dumb like reading one byte at a time or disabling cache).
In the case of FLAC, the reference decoder reads about 8KB at a time (varying by a few bytes as frame sizes change). Adding a simple caching layer to read slightly larger blocks changed the performance Chris got on the network by about 10x. We don't know if this is specific to certain hardware, operating systems, etc.
As a result of this discovery, we've added a simple caching layer that engages whenever something reads in small blocks (like FLAC). When something reads in large blocks, the layer does nothing. It's possible this could help the performance in other parts of the program that read in small chunks. Sometimes things read a header in little chunks before digging into real data, so this would help those cases as well.
This was the history change:
Faster: File I/O adds a buffering layer that engages when small reads are performed so that underlying reads are never too small (a real world example where this helps is with FLAC playback over some types of wireless networks).
Thanks to Chris for his help.