]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- Significant performance enhancements regarding Sessions/flush()
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 May 2009 18:17:46 +0000 (18:17 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 May 2009 18:17:46 +0000 (18:17 +0000)
commit2be867ffac8881a4a20ca5387063ed207ac876dc
tree30b4a8d0663febea019679442c1f98360eb5ce26
parent6515e84d4c7084d9276922786291f6e047b70b84
- Significant performance enhancements regarding Sessions/flush()
      in conjunction with large mapper graphs, large numbers of
      objects:

      - The Session's "weak referencing" behavior is now *full* -
        no strong references whatsoever are made to a mapped object
        or related items/collections in its __dict__.  Backrefs and
        other cycles in objects no longer affect the Session's ability
        to lose all references to unmodified objects.  Objects with
        pending changes still are maintained strongly until flush.
        [ticket:1398]

        The implementation also improves performance by moving
        the "resurrection" process of garbage collected items
        to only be relevant for mappings that map "mutable"
        attributes (i.e. PickleType, composite attrs).  This removes
        overhead from the gc process and simplifies internal
        behavior.

        If a "mutable" attribute change is the sole change on an object
        which is then dereferenced, the mapper will not have access to
        other attribute state when the UPDATE is issued.  This may present
        itself differently to some MapperExtensions.

        The change also affects the internal attribute API, but not
        the AttributeExtension interface nor any of the publically
        documented attribute functions.

      - The unit of work no longer genererates a graph of "dependency"
        processors for the full graph of mappers during flush(), instead
        creating such processors only for those mappers which represent
        objects with pending changes.  This saves a tremendous number
        of method calls in the context of a large interconnected
        graph of mappers.

      - Cached a wasteful "table sort" operation that previously
        occured multiple times per flush, also removing significant
        method call count from flush().

      - Other redundant behaviors have been simplified in
        mapper._save_obj().
22 files changed:
CHANGES
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/collections.py
lib/sqlalchemy/orm/dependency.py
lib/sqlalchemy/orm/dynamic.py
lib/sqlalchemy/orm/identity.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/state.py [new file with mode: 0644]
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/unitofwork.py
test/orm/attributes.py
test/orm/extendedattr.py
test/orm/instrumentation.py
test/orm/mapper.py
test/orm/query.py
test/orm/session.py
test/orm/unitofwork.py
test/profiling/zoomark_orm.py