diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-08-18 18:05:04 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-08-18 18:05:04 -0400 |
commit | bb16e89674cdd98c07bb1db45853419cb711dd83 (patch) | |
tree | eea8cc9a33fb197ced345ccc8ce9704b8e38a5c9 | |
parent | ccaf3853404957c879a043cdcdab331ca2e568fe (diff) | |
download | sqlalchemy-cython.tar.gz |
- teeny tiny things, we're saving almost nothing. would need tocython
rewrite most everything in optimized pyx for this to be worth it.
-rw-r--r-- | lib/sqlalchemy/orm/loading_speedups.pyx | 27 |
1 files 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, <dict>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, <dict>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"]: |