Math.pow vs Bitwise

JavaScript performance comparison

Revision 4 of this test case created

Preparation code

<script>
  var a = 4,
      b = 2,
      c = 0,
      d = b * 2,
      Pow = Math.pow;
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Math.pow
c = Pow(a, b);
pending…
Bitwise
c = a << b;
pending…
Multiply
c = a * d;
pending…
Bitwise w/ const
c = a << 2;
pending…
Multiply w/ const
c = a * 4;
pending…
Multiply w/ float const
c = a * 4.0;
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:

0 comments

Add a comment