The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
curb 0.7.3 performs as expected

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
curb 0.7.3 performs as expected Posted: May 19, 2010 2:47 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: curb 0.7.3 performs as expected
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement

Over loopback, curb runs about 2.4x the speed of net-http-persistent. This is the performance I expected curb to give. Having a pure-ruby library perform 2.4x worse than a C library makes net/http a fantastic library.

Remember, this benchmark and the previous one were designed to model a web-service type workload where many small requests are made. These benchmarks aren't designed to model downloading large files.

require 'rubygems'
require 'benchmark'
require 'net/http/persistent'
require 'curb'

# dd if=/dev/zero of=~/Sites/zeros-1k bs=1024 c=1
uri_1k  = URI.parse 'http://localhost/~drbrain/zeros-1k'
uri_2k  = URI.parse 'http://localhost/~drbrain/zeros-2k'
uri_10k = URI.parse 'http://localhost/~drbrain/zeros-10k'

uri = uri_2k

N = 100_000

Benchmark.bmbm do |bm|
  bm.report 'Net::HTTP::Persistent' do
    http_p = Net::HTTP::Persistent.new

    N.times do
      response = http_p.request uri
      response.body
    end
  end

  bm.report 'curb' do
    curl = Curl::Easy.new
    url = uri.to_s

    N.times do
      curl.url = url
      curl.perform
      curl.body_str
    end
  end
end
Rehearsal ---------------------------------------------------------
Net::HTTP::Persistent  54.070000   3.930000  58.000000 ( 71.651048)
curb                   11.800000   4.510000  16.310000 ( 30.930453)
----------------------------------------------- total: 74.310000sec

                            user     system      total        real
Net::HTTP::Persistent  54.130000   3.930000  58.060000 ( 72.430575)
curb                   11.860000   4.540000  16.400000 ( 30.804222)

Read: curb 0.7.3 performs as expected

Topic: The Amethyst Import/Convert Wizard Previous Topic   Next Topic Topic: Documentation-Generated Irb Autocompletions With Bond and Yard

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use