require 'rubygems' require 'alf' require File.expand_path('../mar_reader', __FILE__) require File.expand_path('../gz_reader', __FILE__) require 'benchmark' def which_ruby if Object.const_defined?(:RUBY_DESCRIPTION) RUBY_DESCRIPTION =~ /^([^\s]+\s*[^\s]+)/ $1 else "ruby #{RUBY_VERSION} (#{RUBY_PLATFORM})" end end log = Alf::Environment.folder('.').dataset("hitradio.log") rash = Alf::Environment.folder('.').dataset("hitradio.rash") mar = Alf::Environment.folder('.').dataset("hitradio.mar") gz = Alf::Environment.folder('.').dataset("hitradio.mar.gz") puts which_ruby Benchmark.bm do |bench| bench.report('.log'){ log.each{} } bench.report('.rash'){ rash.each{} } bench.report('.mar'){ mar.each{} } bench.report('.gz'){ gz.each{} } end