i++ vs i += 1 vs ++i vs i = i + 1 (v3)

Revision 3 of this benchmark created by Mourner on


Setup

i = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
i++
i++;
ready
i += 1
i += 1;
ready
++i
++i;
ready
i = i + 1
i = i + 1;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.