Skip to content

Instantly share code, notes, and snippets.

@jweiss
Created April 24, 2011 16:59
Show Gist options
  • Select an option

  • Save jweiss/939696 to your computer and use it in GitHub Desktop.

Select an option

Save jweiss/939696 to your computer and use it in GitHub Desktop.
EventMachine vs. REE
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'eventmachine'
require 'benchmark'
5.times do
puts "URI get: (%.3fs)" % [Benchmark.realtime{ Net::HTTP.get URI.parse('http://www.google.com') }]
end
Thread.new do
EM.epoll
EM.run do
puts "In the loop"
end
end
5.times do
puts "URI get: (%.3fs)" % [Benchmark.realtime{ Net::HTTP.get URI.parse('http://www.google.com') }]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment