Skip to content

Instantly share code, notes, and snippets.

@arthurschreiber
Last active December 15, 2015 05:49
Show Gist options
  • Save arthurschreiber/5211665 to your computer and use it in GitHub Desktop.
Save arthurschreiber/5211665 to your computer and use it in GitHub Desktop.
require "benchmark/ips"
$LOAD_PATH.unshift("./lib")
require "rugged"
Benchmark.ips do |x|
# Typical mode, runs the block as many times as it can
x.report("Rugged::Repository.open") { Rugged::Repository.open("test/fixtures/testrepo.git") }
# Typical mode, runs the block as many times as it can
repo = Rugged::Repository.open("test/fixtures/testrepo.git")
x.report("Rugged::Branch.each") { Rugged::Branch.each(repo) { |name| } }
x.report("Rugged::Tag.each") { Rugged::Tag.each(repo) { |name| } }
x.report("Rugged::Reference.each") { Rugged::Reference.each(repo) { |name| } }
x.report("Rugged::Reference.lookup") { Rugged::Reference.lookup(repo, "refs/heads/master") }
end
Arthurs-iMac-2:rugged arthur$ ruby bench.rb
Calculating -------------------------------------
Rugged::Repository.open
1258 i/100ms
Rugged::Branch.each 886 i/100ms
Rugged::Tag.each 786 i/100ms
Rugged::Reference.each
1087 i/100ms
Rugged::Reference.lookup
6896 i/100ms
-------------------------------------------------
Rugged::Repository.open
13912.9 (±11.4%) i/s - 67932 in 5.017153s
Rugged::Branch.each 9530.2 (±4.5%) i/s - 47844 in 5.033163s
Rugged::Tag.each 8409.3 (±0.6%) i/s - 42444 in 5.047474s
Rugged::Reference.each
11637.3 (±1.4%) i/s - 58698 in 5.044986s
Rugged::Reference.lookup
93143.6 (±12.8%) i/s - 462032 in 5.062441s
Arthurs-iMac-2:rugged arthur$ LD_LIBRARY_PATH=vendor/libgit2/build/ ruby bench.rb
Calculating -------------------------------------
Rugged::Repository.open
924 i/100ms
Rugged::Branch.each 993 i/100ms
Rugged::Tag.each 701 i/100ms
Rugged::Reference.each
953 i/100ms
Rugged::Reference.lookup
2869 i/100ms
-------------------------------------------------
Rugged::Repository.open
9957.4 (±14.4%) i/s - 48972 in 5.077639s
Rugged::Branch.each 10482.9 (±6.6%) i/s - 52629 in 5.047112s
Rugged::Tag.each 7195.3 (±1.8%) i/s - 36452 in 5.067906s
Rugged::Reference.each
9740.0 (±5.2%) i/s - 48603 in 5.005647s
Rugged::Reference.lookup
32233.5 (±11.7%) i/s - 160664 in 5.054503s
Arthurs-iMac-2:rugged arthur$ LD_LIBRARY_PATH=vendor/libgit2/build/ ruby bench.rb
Calculating -------------------------------------
Rugged::Repository.open
1263 i/100ms
Rugged::Branch.each 919 i/100ms
Rugged::Tag.each 782 i/100ms
Rugged::Reference.each
1101 i/100ms
Rugged::Reference.lookup
7603 i/100ms
-------------------------------------------------
Rugged::Repository.open
13553.0 (±11.0%) i/s - 66939 in 5.009329s
Rugged::Branch.each 9294.2 (±2.0%) i/s - 46869 in 5.044808s
Rugged::Tag.each 8206.6 (±0.5%) i/s - 41446 in 5.050501s
Rugged::Reference.each
11634.8 (±0.6%) i/s - 58353 in 5.015599s
Rugged::Reference.lookup
82444.5 (±4.5%) i/s - 418165 in 5.082872s
Arthurs-iMac-2:rugged arthur$ LD_LIBRARY_PATH=vendor/libgit2/build/ ruby bench.rb
Calculating -------------------------------------
Rugged::Repository.open
842 i/100ms
Rugged::Branch.each 766 i/100ms
Rugged::Tag.each 597 i/100ms
Rugged::Reference.each
691 i/100ms
Rugged::Reference.lookup
2336 i/100ms
-------------------------------------------------
Rugged::Repository.open
9000.3 (±8.1%) i/s - 45468 in 5.086190s
Rugged::Branch.each 8141.9 (±1.5%) i/s - 41364 in 5.081552s
Rugged::Tag.each 6142.8 (±3.3%) i/s - 31044 in 5.059401s
Rugged::Reference.each
7168.7 (±0.7%) i/s - 35932 in 5.012614s
Rugged::Reference.lookup
26669.7 (±4.7%) i/s - 133152 in 5.004558s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment