summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens W. Klein <jk@kleinundpartner.at>2020-01-28 10:45:59 +0100
committerJens W. Klein <jk@kleinundpartner.at>2020-01-28 10:53:20 +0100
commit24a8b54a8bffb8a18e713213ac0da74ec058ab0c (patch)
treea7b63e3cd34dc2f26f009f409f215193f22fc41d
parent49126928256538029ed8ae51c38cc945d726fd7d (diff)
downloadzope-interface-hash_performance_2.tar.gz
Remove unneeded overwrite and call to anyway inherited __hash__ methodhash_performance_2
-rw-r--r--CHANGES.rst7
-rw-r--r--src/zope/interface/declarations.py3
2 files changed, 7 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index cfb52d4..ad7140b 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -54,6 +54,13 @@
fields in your subclass before attempting to hash or sort it. See
`issue 157 <https://github.com/zopefoundation/zope.interface/issues/157>`_.
+- Remove unneeded overwrite and call to anyway inherited `__hash__` method
+ from `.declarations.Implements` class. Watching a reindex index process in
+ ZCatalog with on a Py-Spy after 10k samples the time for `.adapter._lookup`
+ was reduced from 27.5s to 18.8s (~1.5x faster). Overall reindex index time
+ shrunk from 369s to 293s (1.26x faster). See
+ `PR 161 <https://github.com/zopefoundation/zope.interface/pull/161>`_.
+
4.7.1 (2019-11-11)
==================
diff --git a/src/zope/interface/declarations.py b/src/zope/interface/declarations.py
index 83f424c..63b09fd 100644
--- a/src/zope/interface/declarations.py
+++ b/src/zope/interface/declarations.py
@@ -223,9 +223,6 @@ class Implements(Declaration):
# This spelling works under Python3, which doesn't have cmp().
return (n1 > n2) - (n1 < n2)
- def __hash__(self):
- return Declaration.__hash__(self)
-
# We want equality to be based on identity. However, we can't actually
# implement __eq__/__ne__ to do this because sometimes we get wrapped in a proxy.
# We need to let the proxy types implement these methods so they can handle unwrapping