[Checkins] [zopefoundation/zope.interface] 58ef48: Use dictionary lookups for testing subscribed stat...

GitHub noreply at github.com
Tue Aug 30 16:50:18 CEST 2016


  Branch: refs/heads/master
  Home:   https://github.com/zopefoundation/zope.interface
  Commit: 58ef4872922803fac3429d88fb3c58ae509b17c5
      https://github.com/zopefoundation/zope.interface/commit/58ef4872922803fac3429d88fb3c58ae509b17c5
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2016-08-19 (Fri, 19 Aug 2016)

  Changed paths:
    M .coveragerc
    M CHANGES.rst
    M src/zope/interface/registry.py
    M src/zope/interface/tests/test_registry.py

  Log Message:
  -----------
  Use dictionary lookups for testing subscribed status.

Fixes #46.

Benchmarks show a dramatic improvement; not quite as good as the
demonstration in #46 because the implementation had to be a bit more
complex to properly handle unregistration, but still very good. Here it
is with 20,000 items already registered:
```
   %time add_to_reg(reg, 1000)
   CPU times: user 190 ms, sys: 19.3 ms, total: 209 ms
   Wall time: 203 ms
```

Here's a profile with about 100,000 utilities registered:
```
 %prun add_to_reg(reg, 1000)
   80005 function calls (79005 primitive calls) in 0.713 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
     1000    0.596    0.001    0.621    0.001 adapter.py:202(subscribe)
    12000    0.016    0.000    0.019    0.000 interface.py:518(__hash__)
     1000    0.010    0.000    0.709    0.001 registry.py:206(registerUtility)
3000/2000    0.009    0.000    0.014    0.000 interface.py:255(interfaces)
     2000    0.008    0.000    0.022    0.000 adapter.py:637(changed)
     1000    0.008    0.000    0.025    0.000 registry.py:498(_getUtilityProvided)
     9000    0.008    0.000    0.017    0.000 {method 'get' of 'dict' objects}
     1000    0.008    0.000    0.027    0.000 adapter.py:102(register)
     2000    0.006    0.000    0.008    0.000 adapter.py:450(changed)
     1000    0.005    0.000    0.663    0.001 registry.py:145(registerUtility)
```

I was very careful not to change the pickle at all.

zope.interface and zope.component tests have been run and both pass. (It
was necessary to account for the underlying objects changing because of
the way zope.component cleans up after tests.)


  Commit: 99c35d11e2284d7d8bfb749f9bd8876484992307
      https://github.com/zopefoundation/zope.interface/commit/99c35d11e2284d7d8bfb749f9bd8876484992307
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2016-08-22 (Mon, 22 Aug 2016)

  Changed paths:
    M src/zope/interface/registry.py

  Log Message:
  -----------
  Better naming, and incorporate feedback from @prsephton


  Commit: e01cfad5ffd814f16c0f34f3130d07dc71b327ec
      https://github.com/zopefoundation/zope.interface/commit/e01cfad5ffd814f16c0f34f3130d07dc71b327ec
  Author: Michael Howitz <mh at gocept.com>
  Date:   2016-08-30 (Tue, 30 Aug 2016)

  Changed paths:
    M README.rst

  Log Message:
  -----------
  Merge branch 'master' into fix-46


  Commit: 1e2b756500b7b8518884ff4c3bd8bd64e62641a4
      https://github.com/zopefoundation/zope.interface/commit/1e2b756500b7b8518884ff4c3bd8bd64e62641a4
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2016-08-30 (Tue, 30 Aug 2016)

  Changed paths:
    M src/zope/interface/registry.py

  Log Message:
  -----------
  Fix comment.


  Commit: 4ad360e44ec52b742750c8201676d7fe934f5f2a
      https://github.com/zopefoundation/zope.interface/commit/4ad360e44ec52b742750c8201676d7fe934f5f2a
  Author: Jason Madden <jason+github at nextthought.com>
  Date:   2016-08-30 (Tue, 30 Aug 2016)

  Changed paths:
    M .coveragerc
    M CHANGES.rst
    M src/zope/interface/registry.py
    M src/zope/interface/tests/test_registry.py

  Log Message:
  -----------
  Merge pull request #48 from zopefoundation/fix-46

Use dictionary lookups for testing subscribed status.


Compare: https://github.com/zopefoundation/zope.interface/compare/8138c73db26b...4ad360e44ec5


More information about the checkins mailing list