Message79470
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 |
File name |
Uploaded |
unnamed
|
skip.montanaro,
2009-01-09.14:31:49
|
|
Date |
User |
Action |
Args |
2009-01-09 14:31:53 | skip.montanaro | set | recipients:
+ skip.montanaro |
2009-01-09 14:31:52 | skip.montanaro | link | issue4896 messages |
2009-01-09 14:31:50 | skip.montanaro | create | |
|