Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## Summary [plaintext] N=20 MRI Baseline: 0.847291 (0.093247) (Ruby 1.8.6, Mongrel 1.0.1) Tweak JRuby/Mongrel JRuby/Goldspike/Glassfish 1 2.360453 (0.156210) 5.917601 (0.925197) 2 2.191960 (0.185187) 2.185108 (0.268987) 2a 1.089651 (0.146125) 2.025210 (0.917021) 3 1.032960 (0.122054) 1.109186 (0.282202) 4 1.049965 (0.133111) 1.171060 (0.393758) 5 0.995817 (0.235180) 0.950814 (0.321049) 6 1.101849 (0.330978) 1.232705 (0.419431) Larger values of N Client: JRuby/Mongrel (N=200): 0.801804 (0.082312) JRuby/GS/GF (N=200): 0.847174 (0.053754) JRuby/GS/GF (N=500): 0.832707 (0.039243) Server: JRuby/Mongrel (N=200): 0.719322 (0.093241) JRuby/GS/GF (N=200): 0.840648 (0.078221) JRuby/GS/GF (N=500): 0.805491 (0.047047) ## Key [plaintext] N = number of hits to single page in the application All times in seconds Numbers: Mean (Standard Deviation) Tweaks: 1. JRuby 1.0.1 + Rails 1.2.3, client vm 2. 1 + turn off objectspace (-Djruby.objectspace.enabled=false) 2a. 2 + http://headius.blogspot.com/2007/10/another-performance-discovery-rexml.html 3. 2 + JREXML http://caldersphere.rubyforge.org/jrexml 4. 3 + http://headius.blogspot.com/2007/10/another-performance-discovery-rexml.html 5. 3 except with JRuby trunk 6. 5 except with server vm (-server) ## Benchmark script [ruby] def benchmark_request(url, n = nil) n ||= ENV['N'] && ENV['N'].to_i || 10 require 'net/https' require 'benchmark' uri = URI.parse(url) get = Net::HTTP::Get.new(uri.path) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == "https" results = Hash.new {|h,k| h[k] = 0} times = (1..n).map do bm = Benchmark.measure do res = http.start {|h| h.request(get)} results[res.code] += 1 end puts bm bm end sum = times.inject(0) {|s,t| s + t.real} mean = sum / n sumsq = times.inject(0) {|s,t| s + t.real * t.real} sd = Math.sqrt((sumsq - (sum * sum / n)) / (n - 1)) puts("Mean: %0.6f SDev: %0.6f" % [mean, sd]) puts results.inject("Responses: ") {|str,kv| str << "#{kv.first}: #{kv.last} "} end
This paste will be private.
From the Design Piracy series on my blog: