Re: It's ok to __slots__ for what they were intended

2007-12-22 Thread John Nagle
Fredrik Lundh wrote: > John Nagle wrote: > >> I'd like to hear more about what kind of performance gain can be >> obtained from "__slots__". I'm looking into ways of speeding up >> HTML parsing via BeautifulSoup. If a significant speedup can be >> obtained when navigating large trees of sma

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread MrJean1
You are correct. Mea culpa. /Jean Brouwers On Dec 21, 1:41 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > MrJean1 wrote: > > My milage does vary, see this older post > > >   > > > Similar figures are shown with Python 2.5, bot

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread Chris Mellon
On Dec 21, 2007 2:07 PM, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > John Nagle wrote: > > > I'd like to hear more about what kind of performance gain can be > > obtained from "__slots__". I'm looking into ways of speeding up > > HTML parsing via BeautifulSoup. If a significant speedup can be

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread Fredrik Lundh
MrJean1 wrote: > My milage does vary, see this older post > > > > Similar figures are shown with Python 2.5, both for 32- and 64-bit. unless I'm missing something, you're measuring object creation time. I'm measuring attribu

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread MrJean1
My milage does vary, see this older post Similar figures are shown with Python 2.5, both for 32- and 64-bit. /Jean Brouwers On Dec 21, 12:07 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > John Nagle wrote: > >      I'd like

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread Fredrik Lundh
John Nagle wrote: > I'd like to hear more about what kind of performance gain can be > obtained from "__slots__". I'm looking into ways of speeding up > HTML parsing via BeautifulSoup. If a significant speedup can be > obtained when navigating large trees of small objects, that's worth > qu

Re: It's ok to __slots__ for what they were intended

2007-12-21 Thread John Nagle
Chris Mellon wrote: > On 20 Dec 2007 19:50:31 -0800, Aahz <[EMAIL PROTECTED]> wrote: >> In article <[EMAIL PROTECTED]>, >> Carl Banks <[EMAIL PROTECTED]> wrote: Someday I'll have time to write up a proper page about why you shouldn't use __slots__ > Barking out your blanket warning

Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-21 Thread Chris Mellon
On 20 Dec 2007 19:50:31 -0800, Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Carl Banks <[EMAIL PROTECTED]> wrote: > >On Dec 18, 4:49 pm, [EMAIL PROTECTED] (Aahz) wrote: > >> In article <[EMAIL PROTECTED]>, > >> Chris Mellon <[EMAIL PROTECTED]> wrote: > >>> > >>>You can reduc

Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-20 Thread Aahz
In article <[EMAIL PROTECTED]>, Carl Banks <[EMAIL PROTECTED]> wrote: >On Dec 18, 4:49 pm, [EMAIL PROTECTED] (Aahz) wrote: >> In article <[EMAIL PROTECTED]>, >> Chris Mellon <[EMAIL PROTECTED]> wrote: >>> >>>You can reduce the size of new-style classes (inherit from object) by >>>quite a bit if yo

Re: It's ok to __slots__ for what they were intended (was: Don't use __slots__ (was Re: Why custom objects take so much memory?))

2007-12-18 Thread Carl Banks
On Dec 18, 4:49 pm, [EMAIL PROTECTED] (Aahz) wrote: > In article <[EMAIL PROTECTED]>, > > Chris Mellon <[EMAIL PROTECTED]> wrote: > > >You can reduce the size of new-style classes (inherit from object) by > >quite a bit if you use __slots__ to eliminate the class dictionary. > > You can also reduce