Created
July 31, 2017 08:55
-
-
Save artyom/3d6d52e718987d2cefa4a32814eb4d4a to your computer and use it in GitHub Desktop.
This file contains 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
recheck ¶ cat naive.py | |
import re | |
for i in xrange(0,1000000): | |
re.match("^[\w-]+:\s", "foo: bar") | |
recheck ¶ time python naive.py | |
real 0m1.479s | |
user 0m1.443s | |
sys 0m0.020s | |
recheck ¶ cat compiled.py | |
import re | |
r = re.compile("^[\w-]+:\s") | |
for i in xrange(0,1000000): | |
r.match("foo: bar") | |
recheck ¶ time python compiled.py | |
real 0m0.582s | |
user 0m0.556s | |
sys 0m0.015s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment