diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-12-18 21:50:24 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-12-19 10:19:29 -0500 |
commit | 7e9f273835ac68df894568ba4292bfbc74ce187b (patch) | |
tree | 96d3f1590ff45b90a791f92c622737ed3e89fcfb /lib/sqlalchemy/testing/profiling.py | |
parent | 255a6ee18b9d68b5150f1793e0a318d8ccd913bf (diff) | |
download | sqlalchemy-7e9f273835ac68df894568ba4292bfbc74ce187b.tar.gz |
Don't apply aliasing + adaption for simple relationship joins
Identified a performance issue in the system by which a join is constructed
based on a mapped relationship. The clause adaption system would be used
for the majority of join expressions including in the common case where no
adaptation is needed. The conditions under which this adaptation occur
have been refined so that average non-aliased joins along a simple
relationship without a "secondary" table use about 70% less function calls.
Change-Id: Ifbe04214576e5a9fac86ca80c1dc7145c27cd50a
Diffstat (limited to 'lib/sqlalchemy/testing/profiling.py')
-rw-r--r-- | lib/sqlalchemy/testing/profiling.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/testing/profiling.py b/lib/sqlalchemy/testing/profiling.py index bfc4997e1..b837d9b5b 100644 --- a/lib/sqlalchemy/testing/profiling.py +++ b/lib/sqlalchemy/testing/profiling.py @@ -221,7 +221,7 @@ class ProfileStatsFile(object): profile_f.close() -def function_call_count(variance=0.05): +def function_call_count(variance=0.05, times=1): """Assert a target for a test case's function call count. The main purpose of this assertion is to detect changes in @@ -234,8 +234,11 @@ def function_call_count(variance=0.05): def decorate(fn): def wrap(*args, **kw): + timerange = range(times) with count_functions(variance=variance): - return fn(*args, **kw) + for time in timerange: + rv = fn(*args, **kw) + return rv return update_wrapper(wrap, fn) |