From 24a8b54a8bffb8a18e713213ac0da74ec058ab0c Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Tue, 28 Jan 2020 10:45:59 +0100 Subject: Remove unneeded overwrite and call to anyway inherited __hash__ method --- CHANGES.rst | 7 +++++++ src/zope/interface/declarations.py | 3 --- 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 `_. +- 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 `_. + 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 -- cgit v1.2.1