From bb16e89674cdd98c07bb1db45853419cb711dd83 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 18 Aug 2015 18:05:04 -0400 Subject: - teeny tiny things, we're saving almost nothing. would need to rewrite most everything in optimized pyx for this to be worth it. --- lib/sqlalchemy/orm/loading_speedups.pyx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/sqlalchemy/orm/loading_speedups.pyx b/lib/sqlalchemy/orm/loading_speedups.pyx index 8d4f917c1..1254f329a 100644 --- a/lib/sqlalchemy/orm/loading_speedups.pyx +++ b/lib/sqlalchemy/orm/loading_speedups.pyx @@ -109,6 +109,12 @@ def _instance_processor( def _instance(row): + cdef dict dict_ + cdef bint isnew + cdef bint currentload + cdef bint loaded_instance + cdef tuple identitykey + # determine the state that we'll be populating if refresh_identity_key: # fixed state that we're refreshing @@ -175,7 +181,7 @@ def _instance_processor( _populate_full( context, row, state, dict_, isnew, - loaded_instance, populate_existing, populators) + loaded_instance, populate_existing, populators) if isnew: if loaded_instance and load_evt: @@ -204,7 +210,7 @@ def _instance_processor( to_load = _populate_partial( context, row, state, dict_, isnew, - unloaded, populators) + unloaded, populators) if isnew: if refresh_evt: @@ -225,9 +231,11 @@ def _instance_processor( return _instance -def _populate_full( - context, row, state, dict_, isnew, - loaded_instance, populate_existing, populators): +cdef _populate_full( + context, row, state, dict dict_, bint isnew, + loaded_instance, populate_existing, dict populators): + cdef str key + if isnew: # first time we are seeing a row with this identity. state.runid = context.runid @@ -253,9 +261,12 @@ def _populate_full( populator(state, dict_, row) -def _populate_partial( - context, row, state, dict_, isnew, - unloaded, populators): +cdef _populate_partial( + context, row, state, dict dict_, bint isnew, + set unloaded, dict populators): + cdef str key + cdef set to_load + if not isnew: to_load = context.partials[state] for key, populator in populators["existing"]: -- cgit v1.2.1