Created
December 17, 2013 18:03
-
-
Save flopezluis/8009683 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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