On Tuesday 15 August 2006 04:49, Brian Fisher wrote: > On 8/14/06, Alex Holkner <[EMAIL PROTECTED]> wrote: > > Thanks Brian for writing the very useful benchmark script, I'll be > > keeping an eye on it during development. I expect you'll get the same > > performance I am if you use __slots__, a minor change. > > Hmmm.. I had tried using __slots__ on the class early on, thinking it > would potentially be the best python thing you could do because then > your attributes are allocated in your object... when I tested it on > python 2.3 on WinXP it seemed to be about the same performance as > using a list member... it disappointed me at the time because I really > thought it was the best way to go...
Until recently __slots__ could actually perform slower than regular attributes. A *lot* of optimisation effort went into Python 2.5 (including a dedicated Sprint for a week in Iceland with a dozen devs focusing on speed). Richard