[issue30501] Produce optimized code for boolean conditions

2017-06-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue30501] Produce optimized code for boolean conditions

2017-06-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 36ff451ebae41f09560bff582c95946474d898f8 by Serhiy Storchaka in branch 'master': bpo-30501: Make the compiler producing optimized code for condition expressions. (#1851)

[issue30501] Produce optimized code for boolean conditions

2017-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Any high-level benchmarks (i.e. other than pybench and similar programs) > impacted by this? Sorry, I don't have any data. Currently I'm not able to run large benchmarks. I would be surprised if this increases the performance of a macrobenchmark even by

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Emily Morehouse
Changes by Emily Morehouse : -- nosy: +emilyemorehouse ___ Python tracker ___ ___

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: The improved code does look better. I'm +1 on this proposal as long as we're sure it doesn't introduce any new problems. -- ___ Python tracker

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Will this negatively impact code coverage reporting or code tracing (by optimizing across basic blocks)? -- ___ Python tracker

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Any high-level benchmarks (i.e. other than pybench and similar programs) impacted by this? -- nosy: +pitrou ___ Python tracker

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be hard to get the same optimization in the peepholer. For the first example, "if not a and b:", it is easy, just replace UNARY_NOT+POP_JUMP_IF_FALSE with POP_JUMP_IF_TRUE. The more complex third example, "if not (a and b) and c:", would need

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Some examples. if not a and b: x Unpatched: 1 0 LOAD_NAME0 (a) 2 UNARY_NOT 4 POP_JUMP_IF_FALSE 14 6 LOAD_NAME1 (b) 8 POP_JUMP_IF_FALSE 14

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1934 ___ Python tracker ___ ___

[issue30501] Produce optimized code for boolean conditions

2017-05-29 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: The peephole optimizer optimizes some boolean conditions. For example in "if not a:" it replaces UNARY_NOT+POP_JUMP_IF_FALSE with POP_JUMP_IF_TRUE, and in "if a and b:" it makes checking the boolean value of a only once. But it is unable to optimize more