]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Try to measure new style caching in the ORM, take two
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 9 Mar 2020 21:12:35 +0000 (17:12 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 1 Apr 2020 20:12:23 +0000 (16:12 -0400)
commita9b62055bfa61c11e9fe0b2984437e2c3e32bf0e
tree366027c7069edd56d49e9d540ae6a14fbe9e16fe
parente6250123a30e457068878394e49b7ca07ca4d3b0
Try to measure new style caching in the ORM, take two

Supercedes: If78fbb557c6f2cae637799c3fec2cbc5ac248aaf

Trying to see if by making the cache key memoized, we
still can have the older "identity" form of caching
which is the cheapest of all, at the same time as the
newer "cache key each time" version that is not nearly
as cheap; but still much cheaper than no caching at all.

Also needed is a per-execution update of _keymap when
we invoke from a cached select, so that Column objects
that are anonymous or otherwise adapted will match up.
this is analogous to the adaption of bound parameters
from the cache key.

Adds test coverage for the keymap / construct_params()
 changes related to caching.  Also hones performance
to a large extent for statement construction and
cache key generation.

Also includes a new memoized attribute
approach that vastly simplifies the previous approach
of "group_expirable_memoized_property" and finally
integrates cleanly with _clone(), _generate(), etc.
no more hardcoding of attributes is needed, as well
as that most _reset_memoization() calls are no longer
needed as the reset is inherent in a _generate() call;
this also has dramatic performance improvements.

Change-Id: I95c560ffcbfa30b26644999412fb6a385125f663
33 files changed:
examples/performance/short_selects.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/result.py
lib/sqlalchemy/orm/instrumentation.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/sql/annotation.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/sql/dml.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/functions.py
lib/sqlalchemy/sql/schema.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/sql/traversals.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/sql/util.py
lib/sqlalchemy/sql/visitors.py
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/langhelpers.py
test/aaa_profiling/test_memusage.py
test/aaa_profiling/test_misc.py
test/ext/test_baked.py
test/profiles.txt
test/sql/test_compare.py
test/sql/test_compiler.py
test/sql/test_external_traversal.py
test/sql/test_functions.py
test/sql/test_resultset.py
test/sql/test_selectable.py