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 skip.montanaro
Recipients skip.montanaro
Date 2009-01-09.14:31:49
SpamBayes Score 0.058590878
Marked as misclassified No
Message-id <18791.24525.745699.580609@montanaro.dyndns.org>
In-reply-to
Content
The why_code enum in ceval.c has values which form a bit set.  Comparison of
the why variable against multiple values is going to be faster using bitwise
operations instead of logical ones.  For example, instead of

    why == WHY_RETURN || why == WHY_CONTINUE

the equivalent bitwise expression is

    why & (WHY_RETURN | WHY_CONTINUE)

which has fewer operations (one vs three treating the rhs of & as a
constant).  This is already done in one place.  The attached patch converts
all other expressions of the first form.

Also, there are some further manipulations of why in the loop after the
fast_block_end.  The loop can only be entered if why != WHY_NOT.  In the
loop when it is set to WHY_NOT, the loop breaks.  There is thus no reason to
test its value in the while expression.  Further, instead of just breaking
from the loop and then checking the why != WHY_NOT again, just jump past
that check by adding a why_not_here label.

The attached patch implements these changes (against the py3k branch).  All
tests pass on my Mac except test_cmd_line (which has been failing for
awhile).

Skip
Files
File name Uploaded
unnamed skip.montanaro, 2009-01-09.14:31:49
History
Date User Action Args
2009-01-09 14:31:53skip.montanarosetrecipients: + skip.montanaro
2009-01-09 14:31:52skip.montanarolinkissue4896 messages
2009-01-09 14:31:50skip.montanarocreate