Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
Created December 6, 2009 00:40
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 aarongustafson/249946 to your computer and use it in GitHub Desktop.
Save aarongustafson/249946 to your computer and use it in GitHub Desktop.
Regexp performance is faster when you "precompile" (examples from JavaScript Performance Rocks!)
function directPassing ( string )
{
return string.match( /abc/ );
}
var REGEXP = /abc/;
function variablePassing( string )
{
return string.match( REGEXP );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment