variable swap (v2)

Revision 2 of this benchmark created by RobbertAtWork on


Preparation HTML

<script>
  var x=3,
      y=2,
      tmp;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
tmp var
tmp=x;
x=y;
y=tmp;
ready
xor
x^=y;
y^=x;
x^=y;
ready
destructuring assignment
[x,y] = [y,x]
ready

Revisions

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

  • Revision 2: published by RobbertAtWork on