-
-
Save lqez/6353631ea329d5375b41 to your computer and use it in GitHub Desktop.
parser vs strptime
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
from dateutil import parser | |
from datetime import datetime | |
s = "2015-01-01 12:34:56" | |
begin = datetime.now() | |
for _ in xrange(10000): | |
p = parser.parse(s) | |
print datetime.now() - begin | |
begin = datetime.now() | |
for _ in xrange(10000): | |
p = datetime.strptime(s, "%Y-%m-%d %H:%M:%S") | |
print datetime.now() - begin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
parser : 0:00:00.868682
strptime : 0:00:00.166018