Sha256: 859d77b402df6e16daa7338d8eae34bd799a69c9ded81d6393a136a94ca76b62
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'rubygems' require '../lib/marc4j4r' require 'benchmark' filename = 'test.mrc' tags = %w( 245 035 100 010 001 050 300 600 856 260 ) Benchmark.bmbm do |x| x.report("0 tags; nohash") do reader = MARC4J4R.reader(filename) reader.each(false) do |r| tags.each do |t| # fields = r.find_by_tag(t, true) end end end x.report("0 tags; hash") do reader = MARC4J4R.reader(filename) reader.each do |r| tags.each do |t| # fields = r.find_by_tag(t, true) end end end (1..10).each do |i| x.report("#{tags.size * i} tags; nohash") do reader = MARC4J4R.reader(filename) reader.each(false) do |r| i.times do tags.each do |t| fields = r.find_by_tag(t, true) end end end end x.report("#{tags.size * i} tags; hash") do reader = MARC4J4R.reader(filename) reader.each do |r| i.times do tags.each do |t| fields = r.find_by_tag(t) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
marc4j4r-0.1.6 | test/bench.rb |
marc4j4r-0.1.5 | test/bench.rb |
marc4j4r-0.1.4 | test/bench.rb |