Skip to content

Instantly share code, notes, and snippets.

@keating
Created January 12, 2013 09:31
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 keating/4516928 to your computer and use it in GitHub Desktop.
Save keating/4516928 to your computer and use it in GitHub Desktop.
测试JRuby性能代码 Codes for test JRuby performance || Comparing ruby1.9 and JRuby performance
2.times.map {
Thread.new { while true do end }
}.each(&:join)
# encoding: utf-8
require 'mechanize'
agent = Mechanize.new
page = agent.get('http://localhost:3000/login')
form = page.forms[0]
form["user_session[login]"] = "user_cy"
form["user_session[password]"] = "user_cy_pw"
form.submit
100.times.each do |i|
puts i
page = agent.get('http://localhost:3000/cy_maps?query=true')
end
require 'benchmark'
require "open-uri"
loop {
puts Benchmark.measure {
html = open("http://localhost:3000", :read_timeout => 1).read
}
sleep 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment