drophack: major speedup to marker stripping
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 25 Feb 2014 11:14:37 -0800
changeset 812 60dd0c401034
parent 811 acfa2b67cff6
child 813 b49a9276ec8e
drophack: major speedup to marker stripping It appear that each call to obsstore.add have a significant overhead (in particular the creation of a set form the list of markers and file system operation to the obsstore file. We now compute the marker we need to store and write them in a single call.
hgext/drophack.py
tests/test-drop.t
--- a/hgext/drophack.py	Mon Feb 24 19:01:12 2014 -0800
+++ b/hgext/drophack.py	Tue Feb 25 11:14:37 2014 -0800
@@ -71,11 +71,10 @@
     del repo.obsstore # drop the cache
     newstore = repo.obsstore
     assert not newstore # should be empty after rename
+    newmarkers = [m for m in oldmarkers if m not in markers]
     tr = repo.transaction('drophack')
     try:
-        for m in oldmarkers:
-            if m not in markers:
-                newstore.add(tr, [m])
+        newstore.add(tr, newmarkers)
         tr.close()
     finally:
         tr.release()
--- a/tests/test-drop.t	Mon Feb 24 19:01:12 2014 -0800
+++ b/tests/test-drop.t	Tue Feb 25 11:14:37 2014 -0800
@@ -236,7 +236,7 @@
   search nodes: wall * comb * user * sys * (glob)
   2 nodes found
   strip obsmarker: wall * comb * user * sys * (glob)
-  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a2c06c884bfe-drophack.hg (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-drophack.hg (glob)
   strip nodes: wall * comb * user * sys * (glob)
   $ summary
   ============ graph ==============