Skip to content

Instantly share code, notes, and snippets.

@rtomayko
Created December 12, 2010 14:22
Show Gist options
  • Save rtomayko/5603709b6fede6736131 to your computer and use it in GitHub Desktop.
Save rtomayko/5603709b6fede6736131 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$: << File.expand_path('lib')
require 'grit'
Grit::Git.git_timeout = 0
git = Grit::Git.new(Dir.pwd)
# make sure these things happen before the tests run
Grit::Git.git_binary
git.can_fork?
require 'benchmark'
include Benchmark
bm(30) do |measure|
measure.report("sh") {
1000.times {
git.run('', 'rev-parse', '', {:verify => true}, ['HEAD'])
}
}
measure.report("execute") {
1000.times {
git.native(:rev_parse, {:verify => true}, 'HEAD')
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment