N++ or N = N + 1

JavaScript performance comparison

Test case created by Kent Brewster

Info

Which is faster, i++ or i = i + 1?

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Double Plus
for (var i = 0; i < 8675309; i++) {
 var t = i;
}
pending…
The Crockford Form
for (var i = 0; i < 8675309; i = i + 1) {
 var t = i;
}
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