Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Fredrik Lundh
Phillip J. Eby wrote: > I think this is called a "polymorphic inline cache", although it doesn't > seem very polymorphic if you're only caching one type. :) if it's not polymorphic, it's an ordinary inline cache (aka "call-site cache"). (see various Self papers for more on polymorphic caches)

Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Phillip J. Eby
At 06:55 PM 9/14/2005 +0200, Martin v. Löwis wrote: >Neal Norwitz wrote: > > This code doesn't really work in general. It assumes that any append > > function call is a list method, which is obviously invalid. But if a > > variable is known to be a list (ie, local and assigned as list > > (BUILD_

Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Fredrik Lundh
Martin v. Löwis wrote: > Alternatively, couldn't LIST_APPEND check that this really is a list, > and, if it isn't, fall back to PyObject_CallMethod? that's the obvious solution, of course. cf. existing shortcuts: $ grep -n INLINE Python-2.4.1/Python/ceval.c 1103: /* IN

Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Reinhold Birkenfeld
Martin v. Löwis wrote: > Neal Norwitz wrote: >> This code doesn't really work in general. It assumes that any append >> function call is a list method, which is obviously invalid. But if a >> variable is known to be a list (ie, local and assigned as list >> (BUILD_LIST) or a list comprehension),

Re: [Python-Dev] speeding up list append calls

2005-09-14 Thread Martin v. Löwis
Neal Norwitz wrote: > This code doesn't really work in general. It assumes that any append > function call is a list method, which is obviously invalid. But if a > variable is known to be a list (ie, local and assigned as list > (BUILD_LIST) or a list comprehension), could we do something like th

[Python-Dev] speeding up list append calls

2005-09-13 Thread Neal Norwitz
Tim made me do it! http://groups.google.com/group/comp.lang.python/msg/9075a3bc59c334c9 For whatever reason, I was just curious how his code could be sped up. I kept seeing this append method being called and I thought, "there's an opcode for that." What happens if you replace var.append() wi