[pypy-commit] pypy default: speed up unpickling of datetime.datetime objects
justinpeel
noreply at buildbot.pypy.org
Sat Mar 3 22:28:07 CET 2012
Author: Justin Peel <notmuchtotell at gmail.com>
Branch:
Changeset: r53155:3539e2d663f4
Date: 2012-03-03 14:27 -0700
http://bitbucket.org/pypy/pypy/changeset/3539e2d663f4/
Log: speed up unpickling of datetime.datetime objects
diff --git a/lib_pypy/datetime.py b/lib_pypy/datetime.py
--- a/lib_pypy/datetime.py
+++ b/lib_pypy/datetime.py
@@ -1904,10 +1904,11 @@
return (basestate, self._tzinfo)
def __setstate(self, string, tzinfo):
- (yhi, ylo, self._month, self._day, self._hour,
- self._minute, self._second, us1, us2, us3) = map(ord, string)
- self._year = yhi * 256 + ylo
- self._microsecond = (((us1 << 8) | us2) << 8) | us3
+ (self._month, self._day, self._hour, self._minute,
+ self._second) = (ord(string[2]), ord(string[3]), ord(string[4]),
+ ord(string[5]), ord(string[6]))
+ self._year = ord(string[0]) * 256 + ord(string[1])
+ self._microsecond = (((ord(string[7]) << 8) | ord(string[8])) << 8) | ord(string[9])
self._tzinfo = tzinfo
def __reduce__(self):
More information about the pypy-commit
mailing list