Sha256: 15ba547f887e1d1f1963bd82d3ccfb27416879e55b70e07a7967bbdced550c6b
Contents?: true
Size: 876 Bytes
Versions: 7
Compression:
Stored size: 876 Bytes
Contents
require 'gitrb' require 'grit' require 'benchmark' require 'fileutils' REPO_PATH = '/tmp/gitrb_test' FileUtils.rm_rf REPO_PATH FileUtils.mkpath REPO_PATH Dir.chdir REPO_PATH repo = Gitrb::Repository.new(:path => REPO_PATH, :create => true) grit = nil gitrb = nil Benchmark.bm 20 do |x| x.report 'store 1000 objects' do repo.transaction { 'aaa'.upto('jjj') { |key| repo.root[key] = Gitrb::Blob.new(:data => rand.to_s) } } end x.report 'commit one object' do repo.transaction { repo.root['aa'] = Gitrb::Blob.new(:data => rand.to_s) } end x.report 'init gitrb' do gitrb = Gitrb::Repository.new(:path => '.') end x.report 'init grit' do grit = Grit::Repo.new('.') end x.report 'load 1000 with gitrb' do gitrb.root.values.each { |v| v.data } end x.report 'load 1000 with grit' do grit.tree.contents.each { |e| e.data } end end
Version data entries
7 entries across 7 versions & 1 rubygems