Created
May 20, 2014 21:33
-
-
Save abotalov/c0e2477744b2812ba1ed to your computer and use it in GitHub Desktop.
Check speed of text in rack_test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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