Created
July 18, 2010 16:37
-
-
Save bga/480531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you can run it at http://bga.github.com/speedtest/ | |
var _fn = (function() | |
{ | |
var re = /\d/; | |
return function(s) | |
{ | |
re.test(s); | |
}; | |
})(); | |
var _fn2 = function(s) | |
{ | |
/\d/.test(s); | |
}; | |
_speedTest( | |
[ | |
function(n) | |
{ | |
var i = n; while(i--) | |
{ | |
_fn('123'); | |
} | |
}, | |
function(n) | |
{ | |
var i = n; while(i--) | |
{ | |
_fn2('123'); | |
} | |
} | |
], | |
400000 | |
); | |
/* | |
ff3.6 | |
0: 703 ms | |
1: 756 ms | |
chrome5 n*=10 | |
0: 617 ms | |
1: 613 ms | |
ie7 | |
0: 4967 ms | |
1: 7190 ms | |
opera10.60 n*=10 | |
0: 1269 ms | |
1: 1316 ms | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment