kernelsauce/turbo — pull request #123 by jsolman (2014-02-20 15:31:57+00:00)
Title: Squeeze a little more speed out of the base64_encode().

Switch the type of the array for the base64 output encoding to be
uint16_t[] instead of uint8_t[] and use a 16-bit counting index
instead of an incrementing uint16_t*. For some reason in the
encode function LuaJIT 2.0.2 optamizes this case using the array
index more effectively, and from the tests on my AMD FX6100 and my
laptop with an AMD A4 processor, the encode function on Windows
is about 2% faster than the libb64 encode (using binary available
from luapower.org). (Note: contrary to this example, in the
decode function using an incrementing uint8_t* pointer rather
than a counting index to the output bytes array is optamized
better by LuaJIT -- it would be interesting to look into this
further when I have the time to discover the reasons why the
jit compiler behaves the way it does in these examples.)