savonet/shine — pull request #13 by ckthomas (2014-04-08 13:25:40+00:00)
Title: Explicitly unroll loops so shine runs faster.

I have explicitly unrolled several of the loops in the code for better performance. The resulting output mp3 files are not altered by these modifications, although the source code may be slightly more difficult to read. I include some timings for encoding a 24-minute audio file encoding on an Intel i7 3.40 GHz machine.

run time (seconds)
19.5 shine (-O2, default flags)
18.2 lame (for comparison, default flags)
17.9 shine (-O3)
15.1 shine (-funroll-loops -O3)
13.8 shine (-funroll-loops -O2)
13.2 shine (-O3 with my explicit unrolling of 4 loops)
13.1 shine (-O2, default flags, with my explicit unrolling of 4 loops)

Timing results for different audio files produce comparable relative differences for the same ordering. Note that shine with default flags is actually a bit slower than lame on this machine.

I realize that my addition may not be desirable to put into the base code, since the majority of the speedup can be achieved by adding the right compiler flag. But given that my modification is a bit faster still, and that this can be achieved safely without changing the default compilation settings, I think it is worth adding this change.