Increment an integer without opperator (v5)

Revision 5 of this benchmark created on


Setup

var i = 0;
    function increment(int) {
      int ^= (int & ~-~int) | (~int & -~int)
      return int;
    }

Test runner

Ready to run.

Testing in
TestOps/sec
i++
i++;
ready
++i
++i;
ready
i += 1
i += 1;
ready
i = i + 1
var i = 0;
i = i + 1;
ready
Without +
increment(i);
ready

Revisions

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

  • Revision 1: published by MathRobin on
  • Revision 2: published by capiainemousse on
  • Revision 3: published by GromNaN on
  • Revision 4: published by Jayr Magave on
  • Revision 5: published on