mozilla/pdf.js — pull request #4894 by CodingFabian (2014-06-05 10:32:47+00:00)
Title: Optimize JPG.js receiveAndExtend for 1 bit case.

Profiling showed that receiveAndExtend is frequently called with the length of
one bit. This happens for example in decodeBaseline.
For a single bit, the loop and shift in receive, as well as the shifts in
receiveAndExtend are overhead.
This shortcut manually calculates the shifts by either returning 1 or -1 from
receiveAndExtend by reading the bit and deciding on the return value.
While it comes with an overhead for each non-one length, the speedup is at about
10% in the hot parse/decode path.