[Checkins] [zopefoundation/zope.interface] 2d98b8: Move Declaration, Specification and ClassProvides ...

Jason Madden noreply at github.com
Thu Jan 23 17:57:30 CET 2020


  Branch: refs/heads/slots
  Home:   https://github.com/zopefoundation/zope.interface
  Commit: 2d98b8e7d02dfb1fb66415717e5ead66f8e3a9c4
      https://github.com/zopefoundation/zope.interface/commit/2d98b8e7d02dfb1fb66415717e5ead66f8e3a9c4
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    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_declarations.py
    M src/zope/interface/tests/test_interface.py

  Log Message:
  -----------
  Move Declaration, Specification and ClassProvides to __slots__.

In a test of 6000 modules that load 2245 InterfaceClass objects and produce 2233 ClassProvides instances, this saves about 1% total memory usage in Python 2.7.


  Commit: cacd85b78d530336136cac40c42019b8b6946eb0
      https://github.com/zopefoundation/zope.interface/commit/cacd85b78d530336136cac40c42019b8b6946eb0
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2020-01-23 (Thu, 23 Jan 2020)

  Changed paths:
    M src/zope/interface/_zope_interface_coptimizations.c
    M src/zope/interface/interface.py

  Log Message:
  -----------
  Specifications with no dependents are common (4700 out of 7000 in this example), so avoid allocating a WeakKeyDictionary until needed.

This saves another 2% or so.


Compare: https://github.com/zopefoundation/zope.interface/compare/5be2c5ba26e0...cacd85b78d53


More information about the checkins mailing list