[issue2197] Further simplify dict literal bytecode
Alexander Belopolsky [EMAIL PROTECTED] added the comment: Python-3000 discussion http://mail.python.org/pipermail/python- 3000/2008-March/012753.html did not reveal any opposition to the idea of batch processing of dict displays. However, a compromise suggestion was made to limit batches to 256 items http://mail.python.org/pipermail/python-3000/2008-March/012829.html. I don't think this type of micro-optimization belongs to the core. A rare application that would benefit from limited size batch processing can do so explicitly using dict.update. See also relevant discussion at issue2292 (starting at msg65111). I believe this issue can be reopen. I will submit documentation patch if the change is accepted in principle. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2197 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2197] Further simplify dict literal bytecode
Raymond Hettinger [EMAIL PROTECTED] added the comment: -1 I don't think this is worth the semantic change. The current approach doesn't require special cases for different dict sizes. The code/time savings is very small (seven bytes of opcodes per item get condensed by only one byte and the cost of one time around the eval- loop is tiny in comparison to the cost of inserting a new dict entry). Besides, dict literals almost never occur in the inner-loops of time critical code. I recommend that this stay closed. Better to aim for meaningful optimizations using the AST and avoid micro-optimizations that subtly change semantics. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2197 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2197] Further simplify dict literal bytecode
Sean Reifschneider [EMAIL PROTECTED] added the comment: As addition thought is required by Alexander, I'm going to close this as postponed and you can re-open it if after further consideration you think it needs to be applied. Probably would be good to discuss on python-dev if you think it still needs to go forward though. -- assignee: - rhettinger nosy: +jafo priority: - normal resolution: - postponed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2197 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2197] Further simplify dict literal bytecode
New submission from Alexander Belopolsky: I am attaching a proof-of-concept patch that changes the bytecode generated from {1:1,2:2,3:3,4:4} from BUILD_MAP4 LOAD_CONST 2 (1) LOAD_CONST 2 (1) STORE_MAP LOAD_CONST 1 (2) LOAD_CONST 1 (2) STORE_MAP LOAD_CONST 4 (3) LOAD_CONST 4 (3) STORE_MAP LOAD_CONST 3 (4) LOAD_CONST 3 (4) STORE_MAP to LOAD_CONST 1 (4) LOAD_CONST 1 (4) LOAD_CONST 2 (3) LOAD_CONST 2 (3) LOAD_CONST 3 (2) LOAD_CONST 3 (2) LOAD_CONST 4 (1) LOAD_CONST 4 (1) BUILD_MAP4 and changes BUILD_MAP to behave similarly to BUILD_(SET|LIST|TUPLE) and consume 2*n items from the stack. The advantage is more compact and faster bytecode and uniform treatment of BUILD_* instructions. -- components: Interpreter Core files: dict-literal.diff keywords: patch messages: 63063 nosy: belopolsky severity: normal status: open title: Further simplify dict literal bytecode versions: Python 3.0 Added file: http://bugs.python.org/file9564/dict-literal.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2197 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com