Sha256: b0a07f772e29284f9d2159708c6de7ed8bf14dce9229dc49d43adf7df6042c96

Contents?: true

Size: 846 Bytes

Versions: 6

Compression:

Stored size: 846 Bytes

Contents

require 'gitrb'
require 'grit'
require 'benchmark'
require 'fileutils'

REPO = '/tmp/gitrb'

FileUtils.rm_rf REPO
FileUtils.mkpath REPO
Dir.chdir REPO

repo = Gitrb::Repository.new(:path => REPO, :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

6 entries across 6 versions & 1 rubygems

Version Path
gitrb-0.2.1 test/benchmark.rb
gitrb-0.2.0 test/benchmark.rb
gitrb-0.1.9 test/benchmark.rb
gitrb-0.1.8 test/benchmark.rb
gitrb-0.1.7 test/benchmark.rb
gitrb-0.1.6 test/benchmark.rb