Large Data Sets: Use base variables or classes? And some binding questions
Carl Banks
pavlovevidence at gmail.com
Fri Sep 26 20:53:59 EDT 2008
On Sep 26, 7:43 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Fri, 26 Sep 2008 14:54:36 -0700, Carl Banks wrote:
> > However, it seems from the rest of your comments that speed is your main
> > concern. Last time someone reported __slots__ didn't make a big
> > difference in access time, but it probably would speed up creating
> > objects a bit.
>
> Carl probably knows this already, but for the benefit of the Original
> Poster:
>
> __slots__ is intended as a memory optimization, not speed optimization.
> If it speeds up creation, that's a serendipitous side-effect of using
> less memory.
No, it'd be a serendipitous side-effect of not having to take the time
to create a dict object, which is quite a bit more of a direct cause.
It might still end up being slower (creating slot descriptors might
take more time for all I know) but it's more than just an effect of
less memory.
Carl Banks
More information about the Python-list
mailing list