From 5426890ebd5a54fdc450f977137511bbd52f200e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 6 Jun 2011 16:39:27 +0200 Subject: Fixed odb performance tests --- git/test/performance/db/odb_impl.py | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 git/test/performance/db/odb_impl.py (limited to 'git/test/performance/db/odb_impl.py') diff --git a/git/test/performance/db/odb_impl.py b/git/test/performance/db/odb_impl.py new file mode 100644 index 00000000..50ee37e1 --- /dev/null +++ b/git/test/performance/db/odb_impl.py @@ -0,0 +1,69 @@ +"""Performance tests for object store""" + +from time import time +import sys +import stat +import copy + +from git.test.performance.lib import ( + TestBigRepoR, + GlobalsItemDeletorMetaCls + ) + +class PerfBaseDeletorMetaClass(GlobalsItemDeletorMetaCls): + ModuleToDelete = 'TestObjDBPerformanceBase' + + +class TestObjDBPerformanceBase(TestBigRepoR): + __metaclass__ = PerfBaseDeletorMetaClass + + def test_random_access_test(self): + repo = self.rorepo + + # GET COMMITS + st = time() + root_commit = repo.commit(self.head_sha_2k) + commits = list(root_commit.traverse()) + nc = len(commits) + elapsed = time() - st + + print >> sys.stderr, "%s: Retrieved %i commits from ObjectStore in %g s ( %f commits / s )" % (type(repo.odb), nc, elapsed, nc / elapsed) + + # GET TREES + # walk all trees of all commits + st = time() + blobs_per_commit = list() + nt = 0 + for commit in commits: + tree = commit.tree + blobs = list() + for item in tree.traverse(): + nt += 1 + if item.type == 'blob': + blobs.append(item) + # direct access for speed + # END while trees are there for walking + blobs_per_commit.append(blobs) + # END for each commit + elapsed = time() - st + + print >> sys.stderr, "%s: Retrieved %i objects from %i commits in %g s ( %f objects / s )" % (type(repo.odb), nt, len(commits), elapsed, nt / elapsed) + + # GET BLOBS + st = time() + nb = 0 + too_many = 15000 + data_bytes = 0 + for blob_list in blobs_per_commit: + for blob in blob_list: + data_bytes += len(blob.data_stream.read()) + # END for each blobsha + nb += len(blob_list) + if nb > too_many: + break + # END for each bloblist + elapsed = time() - st + + print >> sys.stderr, "%s: Retrieved %i blob (%i KiB) and their data in %g s ( %f blobs / s, %f KiB / s )" % (type(repo.odb), nb, data_bytes/1000, elapsed, nb / elapsed, (data_bytes / 1000) / elapsed) + + -- cgit v1.2.3 From d1032572162f91ee9e67e74321f329238fa32b15 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 6 Jun 2011 16:55:57 +0200 Subject: Fixed packed ODB test, in preparation for separating the type to allow future implementations to use the test as well --- git/test/performance/db/odb_impl.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'git/test/performance/db/odb_impl.py') diff --git a/git/test/performance/db/odb_impl.py b/git/test/performance/db/odb_impl.py index 50ee37e1..fd1abdee 100644 --- a/git/test/performance/db/odb_impl.py +++ b/git/test/performance/db/odb_impl.py @@ -17,6 +17,10 @@ class PerfBaseDeletorMetaClass(GlobalsItemDeletorMetaCls): class TestObjDBPerformanceBase(TestBigRepoR): __metaclass__ = PerfBaseDeletorMetaClass + #{ Configuration + RepoCls = None # to be set by subclass + #} END configuration + def test_random_access_test(self): repo = self.rorepo -- cgit v1.2.3 From 155158e1410ff036812a87975cce6cb91aa8280e Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 6 Jun 2011 17:15:12 +0200 Subject: Added PackedDB test with generalized type to allows other implementations to be tested as well at some point --- git/test/performance/db/odb_impl.py | 1 - 1 file changed, 1 deletion(-) (limited to 'git/test/performance/db/odb_impl.py') diff --git a/git/test/performance/db/odb_impl.py b/git/test/performance/db/odb_impl.py index fd1abdee..677cf6a8 100644 --- a/git/test/performance/db/odb_impl.py +++ b/git/test/performance/db/odb_impl.py @@ -3,7 +3,6 @@ from time import time import sys import stat -import copy from git.test.performance.lib import ( TestBigRepoR, -- cgit v1.2.3