This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author blaisorblade
Recipients ajaksu2, blaisorblade, pitrou
Date 2009-01-14.05:23:00
SpamBayes Score 0.06525171
Marked as misclassified No
Message-id <1231910582.19.0.885397677047.issue4941@psf.upfronthosting.co.za>
In-reply-to
Content
If speedup on other machines are confirmed, a slowdown of less than 2%
should be acceptable (it's also similar to the statistic noise I have on
my machine - it's a pity pybench does not calculate the standard
deviation of the execution time).

It is true that many objects are short lived, and that makes
generational GC work, but the patch is about another point. Do most
refcount decrements lead to garbage collection? That's a completely
different question. And I don't think that popping a function call
argument usually leads to a destructor invocation, for instance, unless
the argument is a temporary. The same reasoning holds for most other
opcodes.

The simplest way to check this is to look at the compilation output with
Profile-Guided Optimization active and verify which branch is optimized.

Having said that, the slowdown you get (on your Athlon X2 3600+) might
be due to a higher cost in case of failed static prediction, since that
leads to 2 jumps.

This code leads to 0 or 1 jump:

if (likely(cond)) {
  destructor
}

while with unlikely, one runs through either 0 or 2 jumps. The second
jump is unconditional, so it has a much smaller delay (the decode unit
has to tell the fetch unit to fetch another instruction). However, in
that case one has to invoke anyway the destructor through a virtual
call, which is much more expensive.
History
Date User Action Args
2009-01-14 05:23:02blaisorbladesetrecipients: + blaisorblade, pitrou, ajaksu2
2009-01-14 05:23:02blaisorbladesetmessageid: <1231910582.19.0.885397677047.issue4941@psf.upfronthosting.co.za>
2009-01-14 05:23:01blaisorbladelinkissue4941 messages
2009-01-14 05:23:00blaisorbladecreate