Skip to content

Instantly share code, notes, and snippets.

@danielevans
Last active December 16, 2015 20:19
Show Gist options
  • Save danielevans/5492040 to your computer and use it in GitHub Desktop.
Save danielevans/5492040 to your computer and use it in GitHub Desktop.
Speed comparisons for complicated app/action ruby 2.0.0 vs 1.9.3-p392 in thin, webrick and unicorn
100x requests to the same action performed in sequence via curl
# 2.0.0-p0 - Unicorn
total time 23.029224000000003
average times 0.23029224000000004
min 0.160939
max 0.368869
# 1.9.3-p392 - Unicorn
total time 20.123345999999998
average times 0.20123345999999998
min 0.160461
max 0.250042
# 2.0.0-p0 - Webrick (rails s)
total time 19.932098999999997
average times 0.19932098999999998
min 0.142152
max 1.052716
# 1.9.3-p392 - Webrick (rails s)
total time 19.83378399999999
average times 0.1983378399999999
min 0.143311
max 1.151987
# 2.0.0-p0 thin
total time 21.462498000000007
average times 0.21462498000000008
min 0.136645
max 0.299611
# 1.9.3-p392 thin
total time 18.081339999999997
average times 0.18081339999999999
min 0.138163
max 0.258644
# 2.0.0-p0 puma
total time 20.564277999999998
average times 0.20564277999999997
min 0.134949
max 0.307431
# 1.9.3-p392 puma
total time 18.203099
average times 0.18203099
min 0.139841
max 0.233363
# the version of ruby used for this script did not change between tests.
require 'benchmark'
results = 100.times.map do
Benchmark.realtime do
IO.popen("curl http://localhost:3000/api/polls.json").read
end
end
puts <<-RESULTS
total time #{results.reduce(&:+)}
average times #{results.reduce(&:+)/results.length.to_f}
min #{results.min}
max #{results.max}
RESULTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment