Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r67375:b8d22f47402d
Date: 2013-10-15 00:06 +0200
http://bitbucket.org/pypy/pypy/changeset/b8d22f47402d/
Log: Miniscule optimization to mapdict.
n is a constant here because it comes from the closure so subtract 1
from it before doing the arithmetic, this way we generate len(...) +
CONSTANT instead of len(...) + CONSTANT - 1
diff --git a/pypy/objspace/std/mapdict.py b/pypy/objspace/std/mapdict.py
--- a/pypy/objspace/std/mapdict.py
+++ b/pypy/objspace/std/mapdict.py
@@ -556,7 +556,7 @@
def _mapdict_storage_length(self):
if self._has_storage_list():
- return len(self._mapdict_get_storage_list()) + n - 1
+ return len(self._mapdict_get_storage_list()) + (n - 1)
return n
def _set_mapdict_storage_and_map(self, storage, map):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit