Created
January 12, 2013 09:31
-
-
Save keating/4516928 to your computer and use it in GitHub Desktop.
测试JRuby性能代码 Codes for test JRuby performance || Comparing ruby1.9 and JRuby performance
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
2.times.map { | |
Thread.new { while true do end } | |
}.each(&:join) |
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
# 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 |
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 '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