Created
April 24, 2011 16:59
-
-
Save jweiss/939696 to your computer and use it in GitHub Desktop.
EventMachine vs. REE
This file contains hidden or 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
| #!/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