Skip to content

Instantly share code, notes, and snippets.

@abotalov
Created May 20, 2014 21:33
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 abotalov/c0e2477744b2812ba1ed to your computer and use it in GitHub Desktop.
Save abotalov/c0e2477744b2812ba1ed to your computer and use it in GitHub Desktop.
Check speed of text in rack_test
require 'capybara'
require 'benchmark'
[
'http://www.stackoverflow.com',
'http://www.google.com',
'http://www.facebook.com',
'http://www.github.com',
].each do |url|
sess = Capybara::Session.new(:selenium)
sess.visit(url)
source = sess.html
app = proc { |env| [200, { "Content-Type" => "text/html" }, [source] ] }
sess = Capybara::Session.new(:rack_test, app)
sess.visit("/")
time = Benchmark.realtime do
sess.text
end
puts "Time for #{url}: #{time}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment