[Checkins] [zopefoundation/ZODB] e714f5: Make all classes new-style. (#160)

GitHub noreply at github.com
Mon Apr 17 15:40:06 CEST 2017


  Branch: refs/heads/master
  Home:   https://github.com/zopefoundation/ZODB
  Commit: e714f515bb33792859d3960afa0ea98a443d6a88
      https://github.com/zopefoundation/ZODB/commit/e714f515bb33792859d3960afa0ea98a443d6a88
  Author: Jason Madden <jason+github at nextthought.com>
  Date:   2017-04-17 (Mon, 17 Apr 2017)

  Changed paths:
    M CHANGES.rst
    M src/ZODB/ActivityMonitor.py
    M src/ZODB/ConflictResolution.py
    M src/ZODB/Connection.py
    M src/ZODB/DB.py
    M src/ZODB/ExportImport.py
    M src/ZODB/FileStorage/FileStorage.py
    M src/ZODB/FileStorage/fsdump.py
    M src/ZODB/MappingStorage.py
    M src/ZODB/UndoLogCompatible.py
    M src/ZODB/blob.py
    M src/ZODB/broken.py
    M src/ZODB/config.py
    M src/ZODB/conversionhack.py
    M src/ZODB/fstools.py
    M src/ZODB/scripts/analyze.py
    M src/ZODB/scripts/fstest.py
    M src/ZODB/scripts/migrate.py
    M src/ZODB/scripts/repozo.py
    M src/ZODB/scripts/tests/test_repozo.py
    M src/ZODB/scripts/zodbload.py
    M src/ZODB/serialize.py
    M src/ZODB/tests/BasicStorage.py
    M src/ZODB/tests/ConflictResolution.py
    M src/ZODB/tests/HistoryStorage.py
    M src/ZODB/tests/IteratorStorage.py
    M src/ZODB/tests/MTStorage.py
    M src/ZODB/tests/PackableStorage.py
    M src/ZODB/tests/PersistentStorage.py
    M src/ZODB/tests/ReadOnlyStorage.py
    M src/ZODB/tests/RevisionStorage.py
    M src/ZODB/tests/Synchronization.py
    M src/ZODB/tests/TransactionalUndoStorage.py
    M src/ZODB/tests/hexstorage.py
    M src/ZODB/tests/testActivityMonitor.py
    M src/ZODB/tests/testBroken.py
    M src/ZODB/tests/testCache.py
    M src/ZODB/tests/testConnection.py
    M src/ZODB/tests/testDemoStorage.py
    M src/ZODB/tests/testMVCCMappingStorage.py
    M src/ZODB/tests/testPersistentList.py
    M src/ZODB/tests/testSerialize.py
    M src/ZODB/tests/testZODB.py
    M src/ZODB/tests/test_cache.py
    M src/ZODB/tests/testconflictresolution.py
    M src/ZODB/tests/testpersistentclass.py
    M src/ZODB/tests/util.py
    M src/ZODB/tests/warnhook.py
    M src/ZODB/utils.py
    M src/ZODB/valuedoc.py

  Log Message:
  -----------
  Make all classes new-style. (#160)

* Make all classes new-style.

On PyPy, it's documented (http://pypy.org/performance.html#id3) that
old-style classes are slow, and classes that derive from both old and
new are especially slow. I checked with the PyPy devs on IRC today and
they confirmed that's still true with the latest PyPy2 releases.

Unfortunately, FileStorage was one such mixed class, as was Connection.

Moving to new-style classes seems to have a positive impact in the
benchmarks. Here's zodbshootout on PyPy2 5.7.1 against a
FileStorage (running in --threads and with 5 reps to be sure we get
warmed up). First, current ZODB:

"Transaction",                fs
"Add 1000 Objects",            31,738
"Update 1000 Objects",         42,444
"Read 1000 Cold Objects",      51,894
"Read 1000 Hot Objects",       53,187
"Read 1000 Steamin' Objects", 835,877

And with this PR:

"Transaction",                fs
"Add 1000 Objects",             35,651
"Update 1000 Objects",          54,906
"Read 1000 Cold Objects",      103,484
"Read 1000 Hot Objects",        84,721
"Read 1000 Steamin' Objects", 2,112,095

The tests that hit the storage extensively are notably faster, as are
steamin and hot, Connection having been a mixed class.

I ran all tests multiple times. The data files were removed between
runs. There's some variation, but the new-style classes always seem
better.

For comparison, here's CPython 2.7.13:

"Transaction",                fs
"Add 1000 Objects",            19,531
"Update 1000 Objects",         16,201
"Read 1000 Cold Objects",      22,111
"Read 1000 Hot Objects",       21,851
"Read 1000 Steamin' Objects", 880,582

Locally I've run the tests under 2.7 and they all passed.




More information about the checkins mailing list