Skip to content

Commit ef5dc3d

Browse files
committed
Optimized test_pack_streaming not to cache the objects anymore. Instead an iterator is provided which does the job. Previously it would easily use 750 MB of ram to keep all the associated objects, more than 350k. Still a lot of memory for just 350k objects, but its python after all
1 parent 0e64168 commit ef5dc3d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

gitdb/ext/smmap

Submodule smmap updated from f097bd6 to 9c3eb3d

gitdb/test/performance/test_pack_streaming.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,17 @@ def test_pack_writing(self):
4040
count = 0
4141
total_size = 0
4242
st = time()
43-
objs = list()
4443
for sha in pdb.sha_iter():
4544
count += 1
46-
objs.append(pdb.stream(sha))
45+
pdb.stream(sha)
4746
if count == ni:
4847
break
4948
#END gather objects for pack-writing
5049
elapsed = time() - st
5150
print >> sys.stderr, "PDB Streaming: Got %i streams by sha in in %f s ( %f streams/s )" % (ni, elapsed, ni / elapsed)
5251

5352
st = time()
54-
PackEntity.write_pack(objs, ostream.write)
53+
PackEntity.write_pack((pdb.stream(sha) for sha in pdb.sha_iter()), ostream.write, object_count=ni)
5554
elapsed = time() - st
5655
total_kb = ostream.bytes_written() / 1000
5756
print >> sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" % (total_kb, elapsed, total_kb/elapsed)

0 commit comments

Comments
 (0)