[issue26722] Fold compare operators on constants (peephole)

2016-04-10 Thread Demur Rumed
Demur Rumed added the comment: I submitted a patch years ago that addressses the ''x,y = 1, 2' case: http://bugs.python.org/issue10648 & it was not met with enthusiasm 2016-04-10 5:08 GMT+00:00 Alexander Marshalov : > > Alexander Marshalov added the comment: > > Hi all,

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread Alexander Marshalov
Alexander Marshalov added the comment: Hi all, this is my first patch to Python. I'm interested in the performance of python code, I even worked on the development of the static optimizer based on modifications of the AST. I had a few ideas for improving peepholer (for example, the expression

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread Nick Coghlan
Nick Coghlan added the comment: Nice work on getting this running, Alexander. However, as Victor and Raymond noted, we're looking to head in a different direction with our bytecode optimisation efforts, which is to better support pluggable AST level optimisations that can make more

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: AFAICT, the cases the OP listed would be rarely found in real code. Victor is correct is saying that we want to limit the scope of the peepholer to the most useful cases. He is also correct in saying that we've long desired constant folding to be moved

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread STINNER Victor
STINNER Victor added the comment: > Do you have any numbers on how common constant comparisons are in real code? In my experience, it almost never occur in real application. But it's common when you start with a constant propogation optimization: *

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread Demur Rumed
Demur Rumed added the comment: Do you have any numbers on how common constant comparisons are in real code? -- nosy: +Demur Rumed ___ Python tracker ___

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread SilentGhost
Changes by SilentGhost : -- nosy: +benjamin.peterson, brett.cannon, georg.brandl, haypo, ncoghlan, yselivanov stage: -> patch review ___ Python tracker

[issue26722] Fold compare operators on constants (peephole)

2016-04-09 Thread Alexander Marshalov
New submission from Alexander Marshalov: Missed peephole optimization: 1 > 2 -> False 3 < 4 -> True 5 == 6 -> False 6 != 7 -> True 7 >= 8 -> False 8 <= 9 -> True 10 is 11 -> False 12 is not 13 -> True 14 in (15, 16, 17) -> False 18 not in (19, 20,