changeset 23497:5817f71c2336

obsstore: disable garbage collection during initialization (issue4456) Python garbage collection is triggered by container creation. So code that creates a lot of tuples tends to trigger GC a lot. We disable the gc during obsolescence marker parsing and associated initialization. This provides an interesting speedup (25%). Load marker function on my 58758 markers repo: before: 0.468247 seconds after: 0.344362 seconds The benefit is a bit less visible overall. With python2.6 on my system I see: after: 0.60 before: 0.53 The difference is probably explained by the delaying of a costly GC. (but there is still a win). Marking involved tuples, lists and dicts as ignorable by the garbage collector should give us more benefit. But this is another adventure. Thanks goes to Siddharth Agarwal for the lead.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 26 Nov 2014 16:58:31 -0800
parents ee5a4ed4c8b1
children ac910b1f5658
files mercurial/obsolete.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Thu Dec 04 05:43:15 2014 -0800
+++ b/mercurial/obsolete.py	Wed Nov 26 16:58:31 2014 -0800
@@ -377,6 +377,7 @@
 formats = {_fm0version: (_fm0readmarkers, _fm0encodeonemarker),
            _fm1version: (_fm1readmarkers, _fm1encodeonemarker)}
 
+@util.nogc
 def _readmarkers(data):
     """Read and enumerate markers from raw data"""
     off = 0
@@ -562,6 +563,7 @@
         version, markers = _readmarkers(data)
         return self.add(transaction, markers)
 
+    @util.nogc
     def _load(self, markers):
         for mark in markers:
             self._all.append(mark)