swap array vs variable (v7)

Revision 7 of this benchmark created by Russell Dempsey on


Description

Variable initialization should be done before the tests in order to remove that variable from the equation.

Setup

var a = 1;
    var b = 2;

Test runner

Ready to run.

Testing in
TestOps/sec
Array shorthand
a=[b,b=a][0]
ready
oldschool
var c = a;
a = b;
b = c;
ready
bit
b^=a^=b;
a^=b;
ready

Revisions

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