[Python-Dev] Slices and "==" optimization

Martin v. Loewis martin@v.loewis.de
Tue, 30 Oct 2001 09:42:12 +0100


> I thinking of extending the __getitem__ hook to accept  slice objects

Please have a look at

http://sourceforge.net/tracker/?func=detail&aid=459235&group_id=5470&atid=105470

It's a known problem, but Guido won't fix it anytime soon. So I guess
contributions are welcome.

> Looking through the code for '==' the optimization for 'a == a'
> seems too far down the call stack. Since interning strings makes
> this case rather common, I'd suggest to lift the optimization into
> the ceval loop

As with all optimizations: Patches to just improve the performance are
unacceptable unless accompanied by some hard numbers to show that they
really do have the desired effect. 

History shows that patches to just improve the performance may be
unacceptable even if accompanied by such numbers. Normally, Tim will
construct a scenario where the patch causes a slow-down, and argue
that this is a common scenario :-)

Regards,
Martin