From: Mike Bayer Date: Sat, 24 May 2014 20:28:23 +0000 (-0400) Subject: - revert the memoized committed_state / callables changes as they appear to add to... X-Git-Tag: rel_1_0_0b1~426 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d4abd2f76acd0d4c427884708cc3b7f1baaaa3f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - revert the memoized committed_state / callables changes as they appear to add to lazy loading. not really clear which approach is better in the long run. --- diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py index 7ff243e3b3..6cf550f887 100644 --- a/lib/sqlalchemy/orm/state.py +++ b/lib/sqlalchemy/orm/state.py @@ -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) diff --git a/test/profiles.txt b/test/profiles.txt index 67ff4cca3f..b05bd6cdd8 100644 --- a/test/profiles.txt +++ b/test/profiles.txt @@ -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