Skip to content

Commit 3c12de3

Browse files
committed
Improved pack writing test to show that the pack generation can be lightning fast with nearly now overhead if the data streams in fast enough (~30 MB/s when writing a pack). This shows that there is huge potential for sending packs, considering that we are actually recompressing them (without deltification). To be faster in future, we could probably just send ref-deltas or full objects as found in the pack without doing any recompression.
1 parent a5497c4 commit 3c12de3

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

git/test/performance/db/test_packedodb_pure.py

+28-21
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,38 @@ class TestPurePackedODB(TestPurePackedODBPerformanceBase):
3333
PackedODBCls = PurePackedODB
3434
#} END configuration
3535

36+
def test_pack_writing_note(self):
37+
sys.stderr.write("test_pack_writing should be adjusted to support different databases to read from - see test for more info")
38+
raise SkipTest()
39+
3640
def test_pack_writing(self):
3741
# see how fast we can write a pack from object streams.
3842
# This will not be fast, as we take time for decompressing the streams as well
43+
# For now we test the fast streaming and slow streaming versions manually
3944
ostream = CountedNullStream()
40-
pdb = self.ropdb
41-
42-
ni = 5000
43-
count = 0
44-
total_size = 0
45-
st = time()
46-
objs = list()
47-
for sha in pdb.sha_iter():
48-
count += 1
49-
objs.append(pdb.stream(sha))
50-
if count == ni:
51-
break
52-
#END gather objects for pack-writing
53-
elapsed = time() - st
54-
print >> sys.stderr, "PDB Streaming: Got %i streams by sha in in %f s ( %f streams/s )" % (ni, elapsed, ni / elapsed)
55-
56-
st = time()
57-
PackEntity.write_pack(objs, ostream.write)
58-
elapsed = time() - st
59-
total_kb = ostream.bytes_written() / 1000
60-
print >> sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" % (total_kb, elapsed, total_kb/elapsed)
45+
# NOTE: We use the same repo twice to see whether OS caching helps
46+
for rorepo in (self.rorepo, self.rorepo, self.ropdb):
47+
48+
ni = 5000
49+
count = 0
50+
total_size = 0
51+
st = time()
52+
objs = list()
53+
for sha in rorepo.sha_iter():
54+
count += 1
55+
objs.append(rorepo.stream(sha))
56+
if count == ni:
57+
break
58+
#END gather objects for pack-writing
59+
elapsed = time() - st
60+
print >> sys.stderr, "PDB Streaming: Got %i streams from %s by sha in in %f s ( %f streams/s )" % (ni, rorepo.__class__.__name__, elapsed, ni / elapsed)
61+
62+
st = time()
63+
PackEntity.write_pack(objs, ostream.write)
64+
elapsed = time() - st
65+
total_kb = ostream.bytes_written() / 1000
66+
print >> sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" % (total_kb, elapsed, total_kb/elapsed)
67+
#END for each rorepo
6168

6269

6370
def test_stream_reading(self):

0 commit comments

Comments
 (0)