# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1541689636 -3600 # Thu Nov 08 16:07:16 2018 +0100 # Node ID ddafb271512fc26de60da5dceffc1509bb023d66 # Parent 8ebe5520cc4ae87f6fccba20897d292489a651db # EXP-Topic sparse-perf # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ddafb271512f sparse-revlog: stop using a heap to track selected gap
Same logic as for 'gapsheap', we don't actually need a heap. diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py +++ b/mercurial/revlogutils/deltas.py @@ -10,7 +10,6 @@ from __future__ import absolute_import import collections -import heapq import struct # import stuff from node for others to import from revlog @@ -296,12 +295,11 @@ def _slicechunktodensity(revlog, revs, t gaps.sort() # Collect the indices of the largest holes until the density is acceptable - indicesheap = [] - heapq.heapify(indicesheap) + selected = [] while gaps and density < targetdensity: gapsize, gapidx = gaps.pop() - heapq.heappush(indicesheap, gapidx) + selected.append(gapidx) # the gap sizes are stored as negatives to be sorted decreasingly # by the heap @@ -310,11 +308,11 @@ def _slicechunktodensity(revlog, revs, t density = chainpayload / float(readdata) else: density = 1.0 + selected.sort() # Cut the revs at collected indices previdx = 0 - while indicesheap: - idx = heapq.heappop(indicesheap) + for idx in selected: chunk = _trimchunk(revlog, revs, previdx, idx) if chunk: _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel