Skip to content

Instantly share code, notes, and snippets.

@Gibheer
Created December 21, 2012 06:58
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 Gibheer/4351123 to your computer and use it in GitHub Desktop.
Save Gibheer/4351123 to your computer and use it in GitHub Desktop.
require 'stringio'
require 'rack-cache'
require 'time'
app = lambda {|env| [200, {'Content-Type' => 'text/html'}, ["Hello World!"]]}
cache = Rack::Cache.new(app, :verbose => true)
threads = []
1.upto(4).each do
threads << Thread.new do
rounds = 500000
start = Time.new
(1..rounds).each do
cache.call({'rack.errors' => StringIO.new})
end
puts ((Time.new - start) / rounds)
end
end
threads.each {|t| t.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment