Merge eats memory

Andrew Bennetts andrew at canonical.com
Fri Jun 3 08:36:41 BST 2005


On Fri, Jun 03, 2005 at 05:25:10PM +1000, Michael Ellerman wrote:
> On Fri, 3 Jun 2005 15:40, Andrew Bennetts wrote:
> > Here's a possible band-aid: it won't reduce the refcounts at all, but it
> > should hopefully reduce the memory footprint a little, and reduce the
> > number of object allocations Python does, by using __slots__.
> >
> > I'd be curious to know if you get a noticeable speed boost or drop in
> > memory consumption from this.  I suspect the benefit will be minimal, but
> > it didn't take long to code :)
> 
> Wow.
> 
> Time:
> 
> with slots	~7m30s
> without slots	~8m30s

That's probably large enough to make this worthwhile.  Damn ;)

> Max memory usage:
> 
> with slots	62056 KB
> without slots	115712 KB

That definitely is!

> References:
> 
> With slots:
> 
> Refcount        Class
> -------------------------------------------------------
> 36882		bzrlib.merge.SourceFile
> 36881		bzrlib.inventory.InventoryEntry
[...]
> 
> Without slots:
> 
> Refcount        Class
> -------------------------------------------------------
> 55319           bzrlib.merge.SourceFile
> 55317           bzrlib.inventory.InventoryEntry

This really surprises me, because these numbers should not change just
because of __slots__.  I wonder what's going on here...

-Andrew.





More information about the bazaar mailing list