Skip to content

Commit

Permalink
Add benchmark for parsing performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Lee committed Feb 24, 2011
1 parent 6ff0ca3 commit 2ef5e9c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions benchmark/benchmark.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby

$:.unshift("lib/")

require 'mp3info'
require 'benchmark'

mp3_file = ARGV.shift

SIZE = 2_000
runner = proc { |parse_mp3| Mp3Info.open(mp3_file, :parse_tags => true, :parse_mp3 => parse_mp3) }

Benchmark.bmbm do |b|
b.report('tags parse') { SIZE.times { runner.call(false) } }
b.report('full parse') { SIZE.times { runner.call(true) } }
end

0 comments on commit 2ef5e9c

Please sign in to comment.