swap array vs variable (v27)

Revision 27 of this benchmark created by dio on


Setup

var a = 1,
        b = 2;

Teardown


    if (a+b !== 3) {
      throw Error();
    }
  

Test runner

Ready to run.

Testing in
TestOps/sec
array
b = [a, a = b][0];
ready
variable
var c = a;

a = b;
b = c;
ready
bit
a = a ^ b;
b = a ^ b;
a = a ^ b;
ready
tmp
a = (_=b,b=a,_);
ready

Revisions

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