summaryrefslogtreecommitdiff
path: root/test/aaa_profiling
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-03-16 12:37:20 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-17 10:11:24 -0400
commit58666d32742dc050c2e48c48ab8f946561636e8b (patch)
tree3355054bc17aa3651aa3d50f7222b9d1f11ddcfe /test/aaa_profiling
parent6acf5d2fca4a988a77481b82662174e8015a6b37 (diff)
downloadsqlalchemy-58666d32742dc050c2e48c48ab8f946561636e8b.tar.gz
remove intermediary _is_clone_of entries when cloning
Improvements in memory usage by the ORM, removing a significant set of intermediary expression objects that are typically stored when a copy of an expression object is created. These clones have been greatly reduced, reducing the number of total expression objects stored in memory by ORM mappings by about 30%. note this change causes the tests to have a bit of a harder time with GC, which we would assume is because mappings now have a lot more garbage to clean up after mappers are configured. it remains to be seen what the long term effects of this are. Fixes: #7823 Change-Id: If8729747ffb9bf27e8974f069a994b5a823ee095
Diffstat (limited to 'test/aaa_profiling')
-rw-r--r--test/aaa_profiling/test_memusage.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/aaa_profiling/test_memusage.py b/test/aaa_profiling/test_memusage.py
index cf89dd6e2..f084eac2c 100644
--- a/test/aaa_profiling/test_memusage.py
+++ b/test/aaa_profiling/test_memusage.py
@@ -346,6 +346,19 @@ class MemUsageTest(EnsureZeroed):
go()
+ def test_clone_expression(self):
+
+ root_expr = column("x", Integer) == 12
+ expr = root_expr
+
+ @profile_memory()
+ def go():
+ nonlocal expr
+
+ expr = cloned_traverse(expr, {}, {})
+
+ go()
+
@testing.add_to_marker.memory_intensive
class MemUsageWBackendTest(fixtures.MappedTest, EnsureZeroed):