]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Memoize AliasedClass, ClauseAdapter objects in joined eager load
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 16 Feb 2017 16:31:26 +0000 (11:31 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 16 Feb 2017 16:31:26 +0000 (11:31 -0500)
commit1a7e8d77bae26450dadc292d4b717f64c2e1af0c
treefaddeaaf957b48b174b5cb88e5b49411ea92be4f
parent3b6004e6ab3fef8e37fb42981c02f4dfa34fe3b7
Memoize AliasedClass, ClauseAdapter objects in joined eager load

Addressed some long unattended performance concerns within the
joined eager loader query construction system.  The use of ad-hoc
:class:`.AliasedClass` objects per query, which produces lots of column
lookup overhead each time, has been replaced with a cached approach
that makes use of a small pool of :class:`.AliasedClass` objects
that are reused between invocations of joined eager loading.
Callcount reduction of SQL query generation for worst-case joined
loader scenarios (lots of joins, lots of columns) is reduced by
approximately 270%.

Change-Id: Ie43beecf37945b2bb7fff0aaa597a597293daa18
Fixes: #3915
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/util.py
test/aaa_profiling/test_orm.py
test/profiles.txt