Message214934
The redesigned peephole optimizer in PY3 improves constant folding. Limiting this would be a step back. Plus you can get the same behavior in PY2 if you first expand the power. For example:
# using 2**30, for a 32-bit process
def uncalled():
x = b'x' * 1073741824
At issue is the design of fold_binops_on_constants in peephole.c:
http://hg.python.org/cpython/file/04f714765c13/Python/peephole.c#l138
Some LBYL may be helpful here. It could get the size and integer value of the two objects before evaluating the switch statement. Then use these values to skip certain operations, such as skipping PyNumber_Multiply in the case of BINARY_MULTIPLY. |
|
Date |
User |
Action |
Args |
2014-03-27 05:04:04 | eryksun | set | recipients:
+ eryksun, vstinner, benjamin.peterson, methane |
2014-03-27 05:04:04 | eryksun | set | messageid: <1395896644.83.0.0127546834957.issue21074@psf.upfronthosting.co.za> |
2014-03-27 05:04:04 | eryksun | link | issue21074 messages |
2014-03-27 05:04:04 | eryksun | create | |
|