Skip to content

Instantly share code, notes, and snippets.

@flopezluis
Created December 17, 2013 18:03
Show Gist options
  • Save flopezluis/8009683 to your computer and use it in GitHub Desktop.
Save flopezluis/8009683 to your computer and use it in GitHub Desktop.
import timeit
def catastrophic(n):
pat = re.compile('([a|b]+)+c')
text = "%s" %('a' * n)
pat.search(text)
from functools import partial
for i in range(100):
cata = partial(catastrophic, i)
print "The function lasted: %f" %timeit.timeit(cata, number=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment