Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r59772:558ae4717951
Date: 2013-01-05 21:10 +0200
http://bitbucket.org/pypy/pypy/changeset/558ae4717951/
Log: a silly speedup
diff --git a/pypy/module/pyexpat/interp_pyexpat.py
b/pypy/module/pyexpat/interp_pyexpat.py
--- a/pypy/module/pyexpat/interp_pyexpat.py
+++ b/pypy/module/pyexpat/interp_pyexpat.py
@@ -182,6 +182,8 @@
def clear(self):
self.next_id = 0
+ self._last_object_id = -1
+ self._last_object = None
self.storage = {}
@staticmethod
@@ -194,10 +196,15 @@
@staticmethod
def get_object(id):
+ if id == global_storage._last_object_id:
+ return global_storage._last_object
return global_storage.storage[id]
@staticmethod
def free_nonmoving_id(id):
+ if id == global_storage._last_object_id:
+ global_storage._last_object = None
+ global_storage._last_object_id = -1
del global_storage.storage[id]
global_storage = Storage()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit