Last active
December 31, 2015 15:49
-
-
Save flopezluis/8009707 to your computer and use it in GitHub Desktop.
Revisions
-
flopezluis revised this gist
Dec 18, 2013 . No changes.There are no files selected for viewing
-
flopezluis revised this gist
Dec 18, 2013 . No changes.There are no files selected for viewing
-
flopezluis revised this gist
Dec 18, 2013 . 1 changed file with 25 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,8 +10,32 @@ def test(f, *args, **kargs): f(*args, **kargs) print "The function %s lasted: %f" %(f.__name__, now() - start) for n in range(20, 30): test(catastrophic, n) Output: Testing with 20 characters The function catastrophic lasted: 0.130457 Testing with 21 characters The function catastrophic lasted: 0.245125 …… The function catastrophic lasted: 14.828221 Testing with 28 characters The function catastrophic lasted: 29.830929 Testing with 29 characters The function catastrophic lasted: 61.110949 -
flopezluis created this gist
Dec 17, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ from time import clock as now def catastrophic(n): pat = re.compile('([a|b]+)+c') text = "%s" %('a' * n) pat.search(text) def test(f, *args, **kargs): start = now() f(*args, **kargs) print "The function %s lasted: %f" %(f.__name__, now() - start) for n in range(10, 100): test(catastrophic, n)