binSwapVars (v6)

Revision 6 of this benchmark created on


Setup

var a = ~~(Math.random()*100000);
    var b = ~~(Math.random()*100000);
    var A = a, B = b;

Teardown


    if (!(a === A && b === B) && !(a === B && b === A)) throw "wtf?";
  

Test runner

Ready to run.

Testing in
TestOps/sec
binary
a^=b; b^=a; a^=b;
ready
temp variable
var c = a;
a = b;
b = c;
delete c;
ready
js 1.7
[a,b]=[b,a]
ready

Revisions

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