diff options
Diffstat (limited to 'test/git/performance')
-rw-r--r-- | test/git/performance/test_commit.py | 2 | ||||
-rw-r--r-- | test/git/performance/test_streams.py | 12 | ||||
-rw-r--r-- | test/git/performance/test_utils.py | 15 |
3 files changed, 22 insertions, 7 deletions
diff --git a/test/git/performance/test_commit.py b/test/git/performance/test_commit.py index bca3ad8b..0571d0d9 100644 --- a/test/git/performance/test_commit.py +++ b/test/git/performance/test_commit.py @@ -91,7 +91,7 @@ class TestPerformance(TestBigRepoRW): slen = stream.tell() stream.seek(0) - cm.sha = make_object(Commit.type, slen, stream) + cm.sha = make_object(IStream(Commit.type, slen, stream)).sha # END commit creation elapsed = time() - st diff --git a/test/git/performance/test_streams.py b/test/git/performance/test_streams.py index 30fd8048..01ec9fc4 100644 --- a/test/git/performance/test_streams.py +++ b/test/git/performance/test_streams.py @@ -1,7 +1,7 @@ """Performance data streaming performance""" from test.testlib import * -from git.odb.db import * +from git.odb import * from array import array from cStringIO import StringIO @@ -51,7 +51,7 @@ class TestObjDBPerformance(TestBigRepoR): # writing - due to the compression it will seem faster than it is st = time() - sha = ldb.store('blob', size, stream) + sha = ldb.store(IStream('blob', size, stream)).sha elapsed_add = time() - st assert ldb.has_object(sha) db_file = ldb.readable_db_object_path(sha) @@ -63,8 +63,8 @@ class TestObjDBPerformance(TestBigRepoR): # reading all at once st = time() - type, size, shastream = ldbstreamsha) - shadata = shastream.read() + ostream = ldb.stream(sha) + shadata = ostream.read() elapsed_readall = time() - st stream.seek(0) @@ -76,9 +76,9 @@ class TestObjDBPerformance(TestBigRepoR): cs = 512*1000 chunks = list() st = time() - type, size, shastream = ldbstreamsha) + ostream = ldb.stream(sha) while True: - data = shastream.read(cs) + data = ostream.read(cs) chunks.append(data) if len(data) < cs: break diff --git a/test/git/performance/test_utils.py b/test/git/performance/test_utils.py index 47366d34..76adffec 100644 --- a/test/git/performance/test_utils.py +++ b/test/git/performance/test_utils.py @@ -42,3 +42,18 @@ class TestUtilPerformance(TestBigRepoR): elapsed = time() - st print >> sys.stderr, "Accessed %s.attr %i times in %s s ( %f acc / s)" % (cls.__name__, ni, elapsed, ni / elapsed) # END for each class type + + # check num of sequence-acceses + for cls in (list, tuple): + x = 10 + st = time() + s = cls(range(x)) + for i in xrange(ni): + s[0] + s[1] + s[2] + # END for + elapsed = time() - st + na = ni * 3 + print >> sys.stderr, "Accessed %s[x] %i times in %s s ( %f acc / s)" % (cls.__name__, na, elapsed, na / elapsed) + # END for each sequence |