[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] 2D vector class



On Mon, Aug 14, 2006 at 11:49:00AM -0700, Brian Fisher wrote:
> On 8/14/06, Alex Holkner <aholkner@xxxxxxxxxxxxxx> 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...

__slots__ is for optimizing memory usage, not speed.

Marius Gedminas
-- 
HOST SYSTEM NOT RESPONDING, PROBABLY DOWN. DO YOU WANT TO WAIT? (Y/N)

Attachment: signature.asc
Description: Digital signature