Message266694
> Perhaps BUILD_CONST_KEY_MAP?
LGTM.
> Ideally the opcode could ellide the LOAD_CONST for the tuple. ie have LOAD_CONST 2 (1, 2, 3), BUILD_CONST_KEY_MAP 3 be BUILD_CONST_KEY_MAP 2 (1, 2, 3). However that'd require stack_effect to somehow lookup the const tuple
I like this idea. But PyCompile_OpcodeStackEffect() doesn't have an access to the consts dict.
> Relying on the peepholer seems unideal; it does more work than generating the tuple the first time & doing it eagerly will produce a more compact stack depth & co_consts
I thought that this would be not easy. But thanks to your encouraging I have tried to do this and the result is pretty simple.
In updated patch the opcode name was changed to BUILD_CONST_KEY_MAP, and the compiler no longer depends on the peephole optimizer for generating constant keys tuple. Thank you Demur. |
|
Date |
User |
Action |
Args |
2016-05-30 14:02:43 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, brett.cannon, georg.brandl, ncoghlan, vstinner, benjamin.peterson, yselivanov, Demur Rumed |
2016-05-30 14:02:41 | serhiy.storchaka | set | messageid: <1464616961.71.0.503051347327.issue27140@psf.upfronthosting.co.za> |
2016-05-30 14:02:41 | serhiy.storchaka | link | issue27140 messages |
2016-05-30 14:02:41 | serhiy.storchaka | create | |
|