/ ZODB Public
Make all classes new-style. #160
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
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 (due to UndoLogCompatible), as was Connection (due to ExportImport).
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:
And with this PR:
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:
Locally I've run the tests under 2.7 and they all passed.
Besides the benchmark improvements, this makes Python 2 closer to Python 3 for those classes.
This was a mechanical transform (with only one mis-change reverted) produced by this script: