Created
August 22, 2008 23:30
-
-
Save derencius/6868 to your computer and use it in GitHub Desktop.
A simple benchmark between open-uri and rio
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
# open-uri vs rio | |
require 'rubygems' | |
require 'open-uri' | |
require 'rio' | |
require 'benchmark' | |
n = 500 | |
Benchmark.bm do |x| | |
x.report { for i in 1..n; open("http://localhost:4000/robots.txt?b#{i}").to_a; end } | |
x.report { for i in 1..n; rio("http://localhost:4000/robots.txt?a#{i}").to_a; end } | |
end | |
# user system total real | |
# 0.610000 0.310000 0.920000 ( 2.752151) | |
# 1.090000 0.350000 1.440000 ( 4.522792) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment