Created
May 12, 2015 15:06
-
-
Save allcentury/08ab203dec55f1ebd1ad to your computer and use it in GitHub Desktop.
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
require 'socket' | |
puts "Using send with a host:" | |
s = UDPSocket.new | |
before_time = Time.now | |
100_000.times do |i| | |
s.send("#{i}", 0, 'localhost', 1234) | |
end | |
puts "Time elapsed was #{Time.now - before_time}" | |
puts "----------------------------\n\n\n" | |
puts "Connecting before using send" | |
s = UDPSocket.new | |
before_time = Time.now | |
s.connect('127.0.0.1', 1234) | |
100_000.times do |i| | |
s.send("#{i}", 0) | |
end | |
puts "Time elapsed was #{Time.now - before_time}" | |
puts "----------------------------\n\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment