biqqles / dataclassy

A fast and flexible reimplementation of data classes
https://pypi.org/project/dataclassy
Mozilla Public License 2.0
81 stars 9 forks source link

Method inheritance broken after v0.7.2 #31

Closed biqqles closed 3 years ago

biqqles commented 3 years ago

Commit 5a2d1a58, included in release v0.7.3, somehow introduced a large performance penalty to class initialisation in some cases. Testing this function with timeit:

python -m timeit -s "import flint; flint.paths.set_install_path('...')" -n1 -r1 "flint.routines.get_markets()"

The runtime goes from ~1.2 seconds to ~5 seconds.

Will update this as I learn more.

Tagging @hroskes as this is related to a change you suggested.

biqqles commented 3 years ago

I finally understand. When dict_ is not updated with all_defaults, the generated methods are always generated instead of being inherited, which has all sorts of awful side-effects. Very stupid and careless bug.

biqqles commented 3 years ago

I've yanked v0.7.3 and v0.7.4 off PyPI.