[PATCH] performance: disable workaround for an old bug of Python

Matt Mackall mpm at selenic.com
Wed Aug 10 18:36:40 EDT 2016


On Wed, 2016-08-10 at 15:54 +0100, Jun Wu wrote:
> I guess some mercurial code is depending on this for perf reasons -
> disabling it would make things slower for CPython.

To quote the comment from this function:

    Python's garbage collector triggers a GC each time a certain number of      
    container objects (the number being defined by gc.get_threshold()) are      
    allocated even when marked not to be tracked by the collector. Tracking has
    no effect on when GCs are triggered, only on what objects the GC looks      
    into. As a workaround, disable GC while building complex (huge)             
    containers.                                                                 
                                                                                
    This garbage collector issue have been fixed in 2.7.    

It's either fixed in 2.7 or it's not. The primary users of this code are
dirstate and obsmarkers, so it should be pretty easy to test. This changeset has
a benchmark:

changeset:   25675:5817f71c2336
user:        Pierre-Yves David <pierre-yves.david at fb.com>
date:        Wed Nov 26 16:58:31 2014 -0800
files:       mercurial/obsolete.py
description:
obsstore: disable garbage collection during initialization (issue4456)

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list