summaryrefslogtreecommitdiff
path: root/test/aaa_profiling
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-02-23 14:40:00 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2017-02-23 16:56:20 -0500
commitfe1cabb88a060378c839bda53992882f67b525c7 (patch)
tree618907c2edc5d9ec183e850eab5a958e789da042 /test/aaa_profiling
parent4c5cfa8bc6cc5dba9a3d8f28abc01f652c0c952e (diff)
downloadsqlalchemy-fe1cabb88a060378c839bda53992882f67b525c7.tar.gz
Performance within instances()
Continuing from Ie43beecf37945b2bb7fff0aaa597a597293daa18, also observed is the overhead of PathRegsitry memoized token functions, as these paths are not cached in the case of long joinedloader chains. The memoizations here were made with short paths in mind, and have been replaced with an inlined straight create of these paths up front, producing callcounts very similar to 0.8. Combined with the previous optimizations, 1.1 now runs the "joined eager load of one row" worst case test in about 40% fewer calls than 0.8 and 60% fewer than 1.1.5. Change-Id: Ib5e1c1345a1dd8edfbdb3fed06eb717d4e164d31 Fixes: #3915
Diffstat (limited to 'test/aaa_profiling')
-rw-r--r--test/aaa_profiling/test_orm.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_orm.py b/test/aaa_profiling/test_orm.py
index 1380ef5c3..61fd532e5 100644
--- a/test/aaa_profiling/test_orm.py
+++ b/test/aaa_profiling/test_orm.py
@@ -655,3 +655,23 @@ class JoinedEagerLoadTest(fixtures.MappedTest):
q._compile_context()
go()
+ def test_fetch_results(self):
+ A, B, C, D, E, F, G = self.classes('A', 'B', 'C', 'D', 'E', 'F', 'G')
+
+ sess = Session()
+
+ q = sess.query(A).options(
+ joinedload(A.bs).joinedload(B.cs).joinedload(C.ds),
+ joinedload(A.es).joinedload(E.fs),
+ defaultload(A.es).joinedload(E.gs),
+ )
+
+ context = q._compile_context()
+
+ @profiling.function_call_count()
+ def go():
+ for i in range(100):
+ obj = q._execute_and_instances(context)
+ list(obj)
+ sess.close()
+ go()