swap array vs variable (v4)

Revision 4 of this benchmark created on


Setup

this.a = 1;
    this.b = 2;

Teardown


    if (this.a + this.b != 3) throw Error();
  

Test runner

Ready to run.

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

this.a = this.b;
this.b = c;
ready
bitwise
this.a = this.a ^ this.b;
this.b = this.a ^ this.b;
this.a = this.a ^ this.b;
ready

Revisions

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