[Python-Dev] PEP 203 Augmented Assignment

Guido van Rossum guido@beopen.com
Fri, 28 Jul 2000 06:42:12 -0500


> Guido van Rossum <guido@beopen.com>:
> 
> > But the two-arg opcode format slows down the opcode decoding -- and
> > that's the most time-critical part of all of ceval.c!
> 
> I don't see why that has to be so, as long as you don't try
> to pre-fetch the extra argument before switching on the
> opcode. Just leave it up to each branch of the switch to
> fetch another argument if needed.

Sure.  That's not how the patch is currently implemented though -- it
adds this to the main opcode decoding:

               if (HAS_2ARG(opcode))
                       oparg2 = NEXTARG();

> In fact, why not do that for one-argument opcodes as well?
> If what you say is true, that should make argument decoding 
> even faster than it is now!

Yes -- but also would cause about 30-40 copies of the same code (which
could be a single macro call).  This could easily be tested and timed
though.

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)