Skip to content

Instantly share code, notes, and snippets.

@rudionrails
Created January 22, 2013 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudionrails/4594223 to your computer and use it in GitHub Desktop.
Save rudionrails/4594223 to your computer and use it in GitHub Desktop.
PSimple performance comparision for Yell with the standard Ruby logger
require 'rubygems'
require 'benchmark'
require 'logger'
require 'yell'
count = 50000
Dir[ '*.log' ].each { |f| File.unlink f }
yell = Yell.new 'yell.log'
logger = Logger.new 'logger.log'
# warmup for jruby
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
STDERR.puts "warming up..."
1000.times { logger.info :info }
1000.times { yell.info :info }
end
# Running Benchmark
Benchmark.bm(10) do |b|
b.report( 'logger' ) { count.times { logger.info :info } }
b.report( 'yell' ) { count.times { yell.info :info } }
end
Kernel.at_exit do
lines = `wc -l *.log`
puts "\n#{lines}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment