[issue17430] missed peephole optimization

2016-12-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: FYI this optimization is already implemented in 3.5+. >>> def fo(): ... if a: ... if b: ... if c: ...print() ... >>> import dis >>> dis.dis(fo) 2 0 LOAD_GLOBAL 0 (a) 2 POP_JUMP_IF_FALSE 18 3

[issue17430] missed peephole optimization

2016-12-13 Thread Camilla Montonen
Changes by Camilla Montonen : -- nosy: +Winterflower ___ Python tracker ___ ___

[issue17430] missed peephole optimization

2013-04-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: The migration to an AST optimizer is a bit of a pie-in-the-sky project. Functionally, it doesn't have many benefits since the scope of legal static optimizations in Python is very narrow (due to the dynamic nature of the language). Therefore, the main benefit

[issue17430] missed peephole optimization

2013-04-10 Thread Ezio Melotti
Ezio Melotti added the comment: ISTM that we were trying to moving towards an AST optimizer and away from the peephole, so I'm not sure it's a good idea to add more optimization to it. #11549 has patches about the AST optimizer. -- nosy: +benjamin.peterson, rhettinger

[issue17430] missed peephole optimization

2013-03-23 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti versions: +Python 3.4 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17430 ___

[issue17430] missed peephole optimization

2013-03-16 Thread STINNER Victor
STINNER Victor added the comment: See my astoptimizer project which allow to implement optimizations in Python rather than in C, and using the AST rather than the bytecode. https://bitbucket.org/haypo/astoptimizer/ I plan to add something in Python 3.4 to be able to plug arbitrary AST hook,

[issue17430] missed peephole optimization

2013-03-16 Thread STINNER Victor
STINNER Victor added the comment: The 2 JUMP_ABSOLUTEs should be optimized away since the code is equivalent to: if a and b and c: as in: Oh, I misread this sentence. I read that you would like to replace if a: if b: with if a and b:. But it can be optimized differently: the useless jump

[issue17430] missed peephole optimization

2013-03-15 Thread Neal Norwitz
New submission from Neal Norwitz: def fo(): ... if a: ... if b: ... if c: ...print ... dis.dis(fo) 2 0 LOAD_GLOBAL 0 (a) 3 POP_JUMP_IF_FALSE 28 3 6 LOAD_GLOBAL 1 (b) 9 POP_JUMP_IF_FALSE