[issue6133] LOAD_CONST followed by LOAD_ATTR can be optimized to just be a LOAD_COST

Alex report at bugs.python.org
Thu May 28 01:19:51 CEST 2009


New submission from Alex <alex.gaynor at gmail.com>:

Basically whenever you have a LOAD_CONST opcode, follwed by a LOAD_ATTR
you can replace both with a single LOAD_CONST.  This optimizes things
like ", ".join or "{} {}".format (in my totally unscientific byte code
hackery it's about a 30% speedup on the loading the function).  This can
be done in the peephole optimizer.

I'll try to work up a patch.

----------
components: Interpreter Core
messages: 88455
nosy: alex
severity: normal
status: open
title: LOAD_CONST followed by LOAD_ATTR can be optimized to just be a LOAD_COST

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6133>
_______________________________________


More information about the Python-bugs-list mailing list