]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- revert the memoized committed_state / callables changes as they appear to add to...
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 May 2014 20:28:23 +0000 (16:28 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 May 2014 20:28:23 +0000 (16:28 -0400)
not really clear which approach is better in the long run.

lib/sqlalchemy/orm/state.py
test/profiles.txt

index 7ff243e3b37e7a6436b7b0495e36dfb7db7e9ff1..6cf550f88767a986f82e73733bd00a4845bac1dc 100644 (file)
@@ -56,8 +56,6 @@ class InstanceState(interfaces._InspectionAttr):
     expired = False
     deleted = False
     _load_pending = False
-    committed_state = util.immutabledict()
-    callables = util.immutabledict()
 
     is_instance = True
 
@@ -65,14 +63,8 @@ class InstanceState(interfaces._InspectionAttr):
         self.class_ = obj.__class__
         self.manager = manager
         self.obj = weakref.ref(obj, self._cleanup)
-
-    @util.memoized_property
-    def callables(self):
-        return {}
-
-    @util.memoized_property
-    def committed_state(self):
-        return {}
+        self.committed_state = {}
+        self.callables = {}
 
     @util.memoized_property
     def attrs(self):
@@ -230,8 +222,7 @@ class InstanceState(interfaces._InspectionAttr):
         if instance_dict:
             instance_dict.discard(self)
 
-        if 'callables' in self.__dict__:
-            del self.callables
+        self.callables.clear()
         self.session_id = self._strong_obj = None
         del self.obj
 
@@ -569,17 +560,15 @@ class InstanceState(interfaces._InspectionAttr):
         for state, dict_ in iter:
             state_dict = state.__dict__
 
-            if 'committed_state' in state_dict:
-                del state_dict['committed_state']
+            state.committed_state.clear()
 
             if '_pending_mutations' in state_dict:
                 del state_dict['_pending_mutations']
 
-            if 'callables' in state_dict:
-                callables = state.callables
-                for key in list(callables):
-                    if key in dict_ and callables[key] is state:
-                        del callables[key]
+            callables = state.callables
+            for key in list(callables):
+                if key in dict_ and callables[key] is state:
+                    del callables[key]
 
             if instance_dict and state.modified:
                 instance_dict._modified.discard(state)
index 67ff4cca3f1ddedc664fbd87a296695759f35dfd..b05bd6cdd8c3a8c11e3de26908d455f3b78ebece 100644 (file)
@@ -145,6 +145,7 @@ test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 2.7_sqlite_
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 2.7_sqlite_pysqlite_nocextensions 4265
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 3.3_mysql_mysqlconnector_cextensions 4266
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 3.3_mysql_mysqlconnector_nocextensions 4266
+test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 3.3_postgresql_psycopg2_cextensions 4266
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 3.3_postgresql_psycopg2_nocextensions 4266
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 3.3_sqlite_pysqlite_cextensions 4266
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_attribute_set 3.3_sqlite_pysqlite_nocextensions 4266
@@ -162,6 +163,7 @@ test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 2.7_sqlite_pysqlite_nocextensions 6525
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 3.3_mysql_mysqlconnector_cextensions 6527
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 3.3_mysql_mysqlconnector_nocextensions 6527
+test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 3.3_postgresql_psycopg2_cextensions 6527
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 3.3_postgresql_psycopg2_nocextensions 6527
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 3.3_sqlite_pysqlite_cextensions 6527
 test.aaa_profiling.test_orm.AttributeOverheadTest.test_collection_append_remove 3.3_sqlite_pysqlite_nocextensions 6527
@@ -310,7 +312,7 @@ test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.2_sqlite_pysqlite_noc
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_mysql_mysqlconnector_cextensions 132,20
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_mysql_mysqlconnector_nocextensions 132,20
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_oracle_cx_oracle_nocextensions 134,19
-test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_postgresql_psycopg2_cextensions 132,20
+test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_postgresql_psycopg2_cextensions 132,18
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_postgresql_psycopg2_nocextensions 127,19
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_sqlite_pysqlite_cextensions 134,19
 test.aaa_profiling.test_orm.MergeTest.test_merge_no_load 3.3_sqlite_pysqlite_nocextensions 127,19