Last Updated: February 25, 2016
· thomaslindstr_m

Use bitwise instead of Math-functions in JavaScript

For a quick and simple performance boost, use bitwise instead of the Math-functions in JavaScript.

Take a look for yourself:

On my iPhone 4, using bitwise is a staggering 60 times faster, and on the high-end Samsung Galaxy s3, it's over 70 times faster.


is the same as

123.123 << 0



can be done like this

(0.5+123.123) << 0

Now go out there and increase your app's performance tenfold!