Increment

JavaScript performance comparison

Test case created

Info

Tries out various methods of incrementing a variable.

Preparation code

<script>
  var x1 = 0;
  var x2 = 0;
  var x3 = 0;
  var x4 = 0;
</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
post-increment
x1++;
pending…
pre-increment
++x2;
pending…
+ 1
x3 = x3 + 1
pending…
+=
x4 += 1;
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