Bit compressing in JavaScript
I tried to speed up your formula :     

return (data[n &gt;&gt; 5] &gt;&gt; (n &amp; 31)) &amp; 1;


.... All results are very close anyway : jsperf.com/fastest-bit-compressing/7. 

• notice that you can inline the function by yourself (replace function call by direct computation).

• you might wan to cache latest array access by yourself during your computations.

• Or you might want to do the caching in the function. Efficiency will depends on the 'randomness' of your
use of the bits.   

function getBit(n) {
    var itemIndex = n &gt;&gt; 5;
    if (itemIndex != lastItemIndex ) {
        lastItem = data[itemIndex];
        lastItemIndex = itemIndex ;
    }
    return lastItem &gt;&gt; (n &amp; 31)) &amp; 1;
}
var lastItemIndex = -1, lastItem = 0;