summaryrefslogtreecommitdiff
path: root/gitdb/test/performance
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-03-31 23:40:04 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-03-31 23:40:10 +0200
commit0c7a3ec9829caa6632afd3e46901be67c63ae7fa (patch)
treec5c4c455e3dd684f1bfe7beaa1bc065800e11fca /gitdb/test/performance
parent184a776960efdc2a83eac571c9c046ffcee3e7c8 (diff)
downloadgitdb-0c7a3ec9829caa6632afd3e46901be67c63ae7fa.tar.gz
Fixed _perf module, which built, but didn't link dynamically. All the time, I think it never successfully imported, but its hard to believe this slipped by.
Added performance test for pack-writing, which isn't really showing what I want as it currently read data from a densly compressed pack which takes most of the time in the nearly pure python implementation. Compared to c++, all the measured performance is just below anything I'd want to use. But we shouldn't forget this is just a test implementation, writing packs is quite simple actually, if you leave out the delta compression part and the delta logic
Diffstat (limited to 'gitdb/test/performance')
-rw-r--r--gitdb/test/performance/test_pack_streaming.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/gitdb/test/performance/test_pack_streaming.py b/gitdb/test/performance/test_pack_streaming.py
index 22a62a3..795ed1e 100644
--- a/gitdb/test/performance/test_pack_streaming.py
+++ b/gitdb/test/performance/test_pack_streaming.py
@@ -8,14 +8,57 @@ from lib import (
)
from gitdb.db.pack import PackedDB
+from gitdb.stream import NullStream
+from gitdb.pack import PackEntity
import os
import sys
from time import time
+from nose import SkipTest
+
+class CountedNullStream(NullStream):
+ __slots__ = '_bw'
+ def __init__(self):
+ self._bw = 0
+
+ def bytes_written(self):
+ return self._bw
+
+ def write(self, d):
+ self._bw += NullStream.write(self, d)
+
class TestPackStreamingPerformance(TestBigRepoR):
+ def test_pack_writing(self):
+ # see how fast we can write a pack from object streams.
+ # This will not be fast, as we take time for decompressing the streams as well
+ ostream = CountedNullStream()
+ pdb = PackedDB(os.path.join(self.gitrepopath, "objects/pack"))
+
+ ni = 5000
+ count = 0
+ total_size = 0
+ st = time()
+ objs = list()
+ for sha in pdb.sha_iter():
+ count += 1
+ objs.append(pdb.stream(sha))
+ if count == ni:
+ break
+ #END gather objects for pack-writing
+ elapsed = time() - st
+ print >> sys.stderr, "PDB Streaming: Got %i streams by sha in in %f s ( %f streams/s )" % (ni, elapsed, ni / elapsed)
+
+ st = time()
+ PackEntity.write_pack(objs, ostream.write)
+ elapsed = time() - st
+ total_kb = ostream.bytes_written() / 1000
+ print >> sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" % (total_kb, elapsed, total_kb/elapsed)
+
+
def test_stream_reading(self):
+ raise SkipTest()
pdb = PackedDB(os.path.join(self.gitrepopath, "objects/pack"))
# streaming only, meant for --with-profile runs