Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
Created December 6, 2009 00:40
Show Gist options
  • Select an option

  • Save aarongustafson/249946 to your computer and use it in GitHub Desktop.

Select an option

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