Skip to content

Instantly share code, notes, and snippets.

@uhop
Created August 12, 2011 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uhop/1141194 to your computer and use it in GitHub Desktop.
Save uhop/1141194 to your computer and use it in GitHub Desktop.
Compare +=, -=, = +, and = -, with 9.
// Compare +=, -=, = +, and = -, with 9.
var a = 1, p9 = 9, m9 = -9;
this.group(
"inc/dec by 9 (var)",
function eq_minus_v9() { a = a - m9; return a; },
function eq_plus_v9() { a = a + p9; return a; },
function minus_eq_v9() { a -= m9; return a; },
function plus_eq_v9() { a += p9; return a; }
);
@uhop
Copy link
Author

uhop commented Aug 12, 2011

Benchmark it with http://www.perfjs.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment