Message266694
| Author |
serhiy.storchaka |
| Recipients |
Demur Rumed, benjamin.peterson, brett.cannon, georg.brandl, ncoghlan, serhiy.storchaka, vstinner, yselivanov |
| Date |
2016年05月30日.14:02:41 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1464616961.71.0.503051347327.issue27140@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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. |
|