Skip to content
Snippets Groups Projects
Commit 526ee887c4d5 authored by Boris Feld's avatar Boris Feld
Browse files

sparse-revlog: stop using a heap to track selected gap

Same logic as for 'gapsheap', we don't actually need a heap.
parent 54de23400b2a
No related branches found
No related tags found
No related merge requests found
......@@ -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,8 +295,7 @@
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()
......@@ -301,7 +299,7 @@
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,6 +308,7 @@
density = chainpayload / float(readdata)
else:
density = 1.0
selected.sort()
# Cut the revs at collected indices
previdx = 0
......@@ -313,8 +312,7 @@
# 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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment