diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-06-30 17:56:40 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-06-30 17:56:40 (GMT) |
commit | 8839617cc9f026f349f7f371025131f224271b9f (patch) | |
tree | 5c366183298fbb858118b5a83cf57e21028a5f3b /Modules/yuv.h | |
parent | 6238d2b024f061159b2613387ff700695c10deef (diff) | |
download | cpython-8839617cc9f026f349f7f371025131f224271b9f.zip cpython-8839617cc9f026f349f7f371025131f224271b9f.tar.gz cpython-8839617cc9f026f349f7f371025131f224271b9f.tar.bz2 |
SF bug #574132: Major GC related performance regression
"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>).
Diffstat (limited to 'Modules/yuv.h')
0 files changed, 0 insertions, 0 deletions