Skip to content

Commit 5d18685

Browse files
committed
Disabled delta-aggregation as it is reduces the throughput to 540KiB/s compared to 9.4MiB compared to the previous brute-force algorithm. Compression helps, but it would probably be more efficient if done right away, not as post-process.
It might help to implement the reversed version of this algorithm, as initially intended, but currently the overhead is the actual application
1 parent bda5ef5 commit 5d18685

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

fun.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ def _move_delta_lbound(d, bytes):
7676

7777
d.to += bytes
7878
d.so += bytes
79-
d.sob += bytes
8079
d.ts -= bytes
8180
if d.has_data():
8281
d.data = d.data[bytes:]
@@ -93,14 +92,12 @@ class DeltaChunk(object):
9392
'so', # start offset in the source buffer in bytes or None
9493
'data', # chunk of bytes to be added to the target buffer,
9594
# DeltaChunkList to use as base, or None
96-
'sob' # DEBUG: Backup
9795
)
9896

9997
def __init__(self, to, ts, so, data):
10098
self.to = to
10199
self.ts = ts
102100
self.so = so
103-
self.sob = so
104101
self.data = data
105102

106103
def __repr__(self):
@@ -135,7 +132,6 @@ def set_copy_chunklist(self, dcl):
135132
"""Set the deltachunk list to be used as basis for copying.
136133
:note: only works if this chunk is a copy delta chunk"""
137134
self.data = dcl
138-
self.sob = self.so
139135
self.so = 0 # allows lbound moves to be virtual
140136

141137
def apply(self, bbuf, write):

stream.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ class DeltaApplyReader(LazyMixin):
311311
"_br" # number of bytes read
312312
)
313313

314+
#{ Configuration
315+
k_max_memory_move = 250*1000*1000
316+
#} END configuration
317+
314318
def __init__(self, stream_list):
315319
"""Initialize this instance with a list of streams, the first stream being
316320
the delta to apply on top of all following deltas, the last stream being the
@@ -325,8 +329,9 @@ def _set_cache_(self, attr):
325329
# the direct algorithm is fastest and most direct if there is only one
326330
# delta. Also, the extra overhead might not be worth it for items smaller
327331
# than X - definitely the case in python
328-
#print "num streams", len(self._dstreams)
329-
#if len(self._dstreams) == 1 or (len(self._dstreams) * self._dstreams.size) > 25*1000*1000:
332+
# hence we apply a worst-case scenario here
333+
# TODO: read the final size from the deltastream - have to partly unpack
334+
# if len(self._dstreams) * self._size < self.k_max_memory_move:
330335
if len(self._dstreams) == 1:
331336
return self._set_cache_brute_(attr)
332337

@@ -353,7 +358,7 @@ def _set_cache_(self, attr):
353358

354359
self._mm_target.seek(0)
355360

356-
def _set_cache_brute_(self, attr):
361+
def _set_cache_(self, attr):
357362
"""If we are here, we apply the actual deltas"""
358363

359364
buffer_info_list = list()

0 commit comments

Comments
 (0)