Skip to content

Instantly share code, notes, and snippets.

@bga
Created January 27, 2010 00:31
Show Gist options
  • Save bga/287413 to your computer and use it in GitHub Desktop.
Save bga/287413 to your computer and use it in GitHub Desktop.
var i,n=300000;
var d0=new Date().getTime();
for(i=0;i<n;++i)
"1.5"-0;
alert("-0: "+(new Date().getTime()-d0)+" ms");
var d0=new Date().getTime();
for(i=0;i<n;++i)
+"1.5";
alert("+: "+(new Date().getTime()-d0)+" ms");
/*
opera 10.10
-0: 581
+: 460
webkit
-0: 1195
+: 997
ff3.6
-0: 421
+: 522
ie7
-0: 771
+: 611
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment