[issue33325] Optimize sequences of constants in the compiler

2019-09-30 Thread Brandt Bucher
Change by Brandt Bucher : -- pull_requests: +16086 pull_request: https://github.com/python/cpython/pull/16498 ___ Python tracker ___ ___

[issue33325] Optimize sequences of constants in the compiler

2018-11-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Good point! Thank you Mark for your comment. In theory, fewer bytecodes is better (the first example doesn't create a new object, it operates with references to existing objects). But in practice the difference is very small and overwhelmed by random facto

[issue33325] Optimize sequences of constants in the compiler

2018-04-22 Thread Mark Shannon
Mark Shannon added the comment: There seems to be an implicit assumption here that fewer bytecodes is better. But that isn't always the case. Do you have evidence that the sequence 0 LOAD_CONST 5 ((('a', 'b', 'c'), 3, 2, 1)) 2 UNPACK_SEQUENCE 4 is actually faster than 0

[issue33325] Optimize sequences of constants in the compiler

2018-04-21 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +6254 stage: -> patch review ___ Python tracker ___ ___ Python-bugs-

[issue33325] Optimize sequences of constants in the compiler

2018-04-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : The following PR makes three optimizations in the compiler. 1. A sequence of several LOAD_CONSTs is replaced with a single LOAD_CONST followed by UNPACK_SEQUENCE. For example, "{'a': 1, 'b': 2, 'c': 3}" is currently compiled to 1 0 LOAD_CONST