[Checkins] [zopefoundation/zope.interface] c5f5a0: Clean up linter errors in test_interface.py so new...

Jason Madden noreply at github.com
Wed Mar 11 18:20:26 CET 2020


  Branch: refs/heads/faster-eq-hash-comparison
  Home:   https://github.com/zopefoundation/zope.interface
  Commit: c5f5a0a95515e5bb2043809dc843c167740d11ad
      https://github.com/zopefoundation/zope.interface/commit/c5f5a0a95515e5bb2043809dc843c167740d11ad
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-11 (Wed, 11 Mar 2020)

  Changed paths:
    M src/zope/interface/tests/test_interface.py

  Log Message:
  -----------
  Clean up linter errors in test_interface.py so new/real problems are more obvious.


  Commit: f7f035ec5058c33c2db34e6b9ff7ca93b7e77374
      https://github.com/zopefoundation/zope.interface/commit/f7f035ec5058c33c2db34e6b9ff7ca93b7e77374
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-11 (Wed, 11 Mar 2020)

  Changed paths:
    M src/zope/interface/tests/__init__.py
    M src/zope/interface/tests/test_interface.py

  Log Message:
  -----------
  Fix tests when zope.component is also importable.


  Commit: c575695972d32246f69f691f9a55234a4a67320c
      https://github.com/zopefoundation/zope.interface/commit/c575695972d32246f69f691f9a55234a4a67320c
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-03-11 (Wed, 11 Mar 2020)

  Changed paths:
    M benchmarks/micro.py
    M src/zope/interface/_zope_interface_coptimizations.c
    M src/zope/interface/declarations.py
    M src/zope/interface/interface.py
    M src/zope/interface/tests/test_interface.py

  Log Message:
  -----------
  Avoid use of a metaclass by implementeng __getattribute__.

This is pretty, but it slows down all attribute access to interfaces.
By up to 25%. I'm not sure that's acceptable for things like
Interface.providedBy.

+-------------------------------------------+------------+-------------------------------+
| Benchmark                                 | 38-master3 | 38-faster3                    |
+===========================================+============+===============================+
| read __module__                           | 41.1 ns    | 44.3 ns: 1.08x slower (+8%)   |
+-------------------------------------------+------------+-------------------------------+
| read __name__                             | 41.3 ns    | 51.6 ns: 1.25x slower (+25%)  |
+-------------------------------------------+------------+-------------------------------+
| read __doc__                              | 41.8 ns    | 53.3 ns: 1.28x slower (+28%)  |
+-------------------------------------------+------------+-------------------------------+
| read providedBy                           | 56.7 ns    | 71.6 ns: 1.26x slower (+26%)  |
+-------------------------------------------+------------+-------------------------------+
| query adapter (no registrations)          | 3.85 ms    | 2.95 ms: 1.31x faster (-23%)  |
+-------------------------------------------+------------+-------------------------------+
| query adapter (all trivial registrations) | 4.59 ms    | 3.65 ms: 1.26x faster (-20%)  |
+-------------------------------------------+------------+-------------------------------+
| contains (empty dict)                     | 136 ns     | 55.4 ns: 2.45x faster (-59%)  |
+-------------------------------------------+------------+-------------------------------+
| contains (populated dict)                 | 137 ns     | 55.0 ns: 2.49x faster (-60%)  |
+-------------------------------------------+------------+-------------------------------+
| contains (populated list)                 | 40.2 us    | 2.95 us: 13.62x faster (-93%) |
+-------------------------------------------+------------+-------------------------------+


Compare: https://github.com/zopefoundation/zope.interface/compare/8e81aab8c576...c575695972d3


More information about the checkins mailing list