Last active
March 20, 2017 11:53
-
-
Save x89/98ab6544e0577184d0c84d03291bc19d to your computer and use it in GitHub Desktop.
Benchmark domain name lookups
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
require 'benchmark' | |
require 'rubydns' | |
domains = [ | |
'google.de', | |
'google.co.uk', | |
'google.com', | |
'google.jp', | |
'redd.it', | |
'reddit.com', | |
'elpais.es' | |
] | |
r = Resolv::DNS.new(:nameserver => "192.168.1.1") | |
Benchmark.bm(13) do |b| | |
domains.each do |domain| | |
b.report("#{domain}") { r.getaddress(domain) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment