summaryrefslogtreecommitdiff
path: root/git/test/performance/db/odb_impl.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-02-10 21:40:53 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-02-10 21:40:53 +0100
commit1cb02ebcaa4891c01a1d6cba11a3cd9806fad782 (patch)
tree51130c659e5089434e84404940ed1451f6c5d5cc /git/test/performance/db/odb_impl.py
parent660bdca125aa9dcca7a7730535bec433edb8ba02 (diff)
parentf77230f618722e964a76657ebb03d822b2f73518 (diff)
downloadgitpython-1cb02ebcaa4891c01a1d6cba11a3cd9806fad782.tar.gz
Merge branch 'feature/spaces-and-cleanup-master'
* feature/spaces-and-cleanup-master: Basic fixes to get tests back on track. Of course there is much more work to be done here removed leftover gitdb - I thought it was merged into git tabs to 4 spaces - overall state of this branch is desolate, but fixable. Needs plenty of work
Diffstat (limited to 'git/test/performance/db/odb_impl.py')
-rw-r--r--git/test/performance/db/odb_impl.py122
1 files changed, 61 insertions, 61 deletions
diff --git a/git/test/performance/db/odb_impl.py b/git/test/performance/db/odb_impl.py
index 677cf6a8..887604c0 100644
--- a/git/test/performance/db/odb_impl.py
+++ b/git/test/performance/db/odb_impl.py
@@ -5,68 +5,68 @@ import sys
import stat
from git.test.performance.lib import (
- TestBigRepoR,
- GlobalsItemDeletorMetaCls
- )
+ TestBigRepoR,
+ GlobalsItemDeletorMetaCls
+ )
class PerfBaseDeletorMetaClass(GlobalsItemDeletorMetaCls):
- ModuleToDelete = 'TestObjDBPerformanceBase'
-
+ ModuleToDelete = 'TestObjDBPerformanceBase'
+
class TestObjDBPerformanceBase(TestBigRepoR):
- __metaclass__ = PerfBaseDeletorMetaClass
-
- #{ Configuration
- RepoCls = None # to be set by subclass
- #} END configuration
-
- 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)
-
-
+ __metaclass__ = PerfBaseDeletorMetaClass
+
+ #{ Configuration
+ RepoCls = None # to be set by subclass
+ #} END configuration
+
+ 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)
+
+