mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:18:12 +00:00
![]() Decoding the residual in FLAC subframes is by far the most I/O-heavy operation in FLAC decoding, as the residual data makes up the majority of subframe data in LPC subframes. As the residual consists of many Rice-encoded numbers with different bit sizes for differently large numbers, the residual decoder frequently reads only one or two bytes at a time. As we use a normal FileInputStream, that directly translates to many calls to the read() syscall. We can see that the I/O overhead while FLAC decoding is quite large, and much time is spent in the read() syscall's kernel code. This is optimized by using a Buffered<FileInputStream> instead, leading to 4K blocks being read at once and a large reduction in I/O overhead. Benchmarking with the new abench utility gives a 15-20% speedup on identical files, usually pushing FLAC decoding to 10-15x realtime speed on common sample rates. |
||
---|---|---|
.. | ||
Buffer.cpp | ||
Buffer.h | ||
ClientConnection.cpp | ||
ClientConnection.h | ||
CMakeLists.txt | ||
FlacLoader.cpp | ||
FlacLoader.h | ||
FlacTypes.h | ||
Loader.cpp | ||
Loader.h | ||
Sample.h | ||
WavLoader.cpp | ||
WavLoader.h | ||
WavWriter.cpp | ||
WavWriter.h |