per-attribute callables due to options, possible reorg to remove performance overhead

Issue #2778 resolved
Mike Bayer repo owner created an issue

e.g.

 827855   15.668    0.000   27.068    0.000 …/SQLAlchemy-0.8.1-py2.6-linux-x86_64.egg/sqlalchemy/orm/strategies.py:184(set_deferred_for_local_state)
   827855   10.524    0.000   10.524    0.000 …/SQLAlchemy-0.8.1-py2.6-linux-x86_64.egg/sqlalchemy/orm/strategies.py:259(__init__)

so here we'd want to see how to have an unloaded attribute's default lazy callable routine access what was set up for the query that loaded this. I think the mapper's loading of the state would have to assemble some aspect of the QueryContext into each state, which is then consulted by the instancestate before we do deferred_scalar_loader. for LazyLoader the issue might be a little different.

something to look into for 0.9 though not critical

Comments (2)

  1. Mike Bayer reporter

    So with some profiling added, previously defer() would bump the callcounts up significantly, it now uses fewer calls than that of loading the column. the change here isn't that dramatic, just not bundling the "state" with those callables (so we only need create one per col, not per col per row) and producing the closure after retrieving the AttributeImpl, not before.

    731a4daf63dc0fdb784d195e89c5f357420657fb 0.8

    5b65af098324a1852c1ca885f5c79b68cd2733c5 master

  2. Log in to comment