Skip to content

Instantly share code, notes, and snippets.

@bga
Created July 18, 2010 18:54
Show Gist options
  • Select an option

  • Save bga/480618 to your computer and use it in GitHub Desktop.

Select an option

Save bga/480618 to your computer and use it in GitHub Desktop.
var _fn = (function()
{
var re = /\d/;
return function(s)
{
return Math.random() + re.test(s);
};
})();
var _fn2 = function(s)
{
return Math.random() + /\d/.test(s);
};
_speedTest(
[
function(n)
{
var i = n; while(i--)
{
_fn('' + Math.random());
}
},
function(n)
{
var i = n; while(i--)
{
_fn2('' + Math.random());
}
}
],
400000
);
/*
ff3.6
0: 3648 ms
1: 3598 ms
chrome5
0: 2334 ms
1: 2255 ms
opera 10.60
0: 3148 ms
1: 3163 ms
ie7 *=10
0: 1142 ms
1: 1352 ms
*/
@itrelease

Copy link
Copy Markdown

Клевая видимо была презентация, жаль не присутствовал на devconf

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