• Tim Peters's avatar
    SF bug #574132: Major GC related performance regression · 8839617c
    Tim Peters yazdı
    "The regression" is actually due to that 2.2.1 had a bug that prevented
    the regression (which isn't a regression at all) from showing up.  "The
    regression" is actually a glitch in cyclic gc that's been there forever.
    
    As the generation being collected is analyzed, objects that can't be
    collected (because, e.g., we find they're externally referenced, or
    are in an unreachable cycle but have a __del__ method) are moved out
    of the list of candidates.  A tricksy scheme uses negative values of
    gc_refs to mark such objects as being moved.  However, the exact
    negative value set at the start may become "more negative" over time
    for objects not in the generation being collected, and the scheme was
    checking for an exact match on the negative value originally assigned.
    As a result, objects in generations older than the one being collected
    could get scanned too, and yanked back into a younger generation.  Doing
    so doesn't lead to an error, but doesn't do any good, and can burn an
    unbounded amount of time doing useless work.
    
    A test case is simple (thanks to Kevin Jacobs for finding it!):
    
    x = []
    for i in xrange(200000):
        x.append((1,))
    
    Without the patch, this ends up scanning all of x on every gen0 collection,
    scans all of x twice on every gen1 collection, and x gets yanked back into
    gen1 on every gen0 collection.  With the patch, once x gets to gen2, it's
    never scanned again until another gen2 collection, and stays in gen2.
    
    Bugfix candidate, although the code has changed enough that I think I'll
    need to port it by hand.  2.2.1 also has a different bug that causes
    bound method objects not to get tracked at all (so the test case doesn't
    burn absurd amounts of time in 2.2.1, but *should* <wink>).
    8839617c
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
PLAN.txt Loading commit data...
README Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...