[PATCH 2 of 4] obsstore: disable garbage collection during initialisation (issue4456)

Matt Mackall mpm at selenic.com
Mon Dec 8 17:51:03 CST 2014


On Fri, 2014-12-05 at 22:34 +0100, Antoine Pitrou wrote:
> On Fri, 05 Dec 2014 14:50:02 -0600
> Matt Mackall <mpm at selenic.com> wrote:
> > > > You're right, the quadratic behavior appears to be gone in 2.7. In 2.7,
> > > > it's down to O(n): generic construction of lists of tuples gets about 4x
> > > > slower. So it's still definitely worth disabling for any potentially
> > > > large list or dict we might build. And obsolete markers are in that
> > > > category.
> > > 
> > > Thanks. I'm wondering if there would be a way to improve our current
> > > heuristics to alleviate such issues.
> > 
> > Maybe adapt the GC threshold proportional to the number of active
> > objects seen at the last GC. "You've got a million objects already? I
> > shouldn't make a fuss when you create another 100000 objects.."
> 
> I'd still like to be sure there's a problem, with a simple reproducer.

Here's a test:

import gc
import time

baseline = []

for x in xrange(10000):
    baseline.append((x, time.time()))
gc.collect()

b2 = []
begin = time.time()
#gc.disable()
for x in xrange(1000000):
    b2.append((x, []))
gc.enable()
gc.collect()

print time.time() - begin

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list