[Python-Dev] PEP 203 Augmented Assignment

Guido van Rossum guido@beopen.com
Fri, 28 Jul 2000 07:41:41 -0500


> > 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.
> 
> Yes, and we won't be able to conclude anything. This is micro-optimization
> which doesn't give meaningful results. Actually, when I played last time
> with the main loop (it was for 1.5.2 I believe) duplicating the second
> argfetch doesn't give any speedup. Mainly because the code for
> the 2nd byte fetch is already in the processor's cache. Consequently,
> testing and fetching the 2nd argbyte (or skipping it) is faster when
> it's done before the big switch. If it's done per opcode, the cache may
> be invalidated.

Fair enough (for one particular CPU at least).

> Micro-optimization doesn't worth the effort. As to the 2-byte arg limit,
> I think I'd be happy if the compiler raises an exception if this limit
> is exceeded.

That would be a good first step indeed!

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