Math.pow vs Bitwise
JavaScript performance comparison
Preparation code
<script>
var a = 4,
b = 2,
c = 0,
Pow = Math.pow;
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test  Ops/sec  

Math.pow 

pending… 
Bitwise 

pending… 
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit
to the URL. Here’s a list of current revisions for this page:
 Revision 1: published by Jason
 Revision 2: published by gdz
 Revision 3: published by Jason
 Revision 4: published
 Revision 5: published
 Revision 6: published by dsdgwrsdfgsdfg
 Revision 7: published
 Revision 9: published
 Revision 10: published
 Revision 11: published
 Revision 13: published
 Revision 15: published
1 comment
witek commented : ∞
This codes aren't equivalent at all. If you know that a=4, and b=2, then just write c=16. For this particular case 4^2 == 4<<2, but in general it is not true. 16^2==256, 16<<2 == 64, for example.
Comment form temporarily disabled.