Skip to content

Instantly share code, notes, and snippets.

@x89
Last active March 20, 2017 11:53
Show Gist options
  • Save x89/98ab6544e0577184d0c84d03291bc19d to your computer and use it in GitHub Desktop.
Save x89/98ab6544e0577184d0c84d03291bc19d to your computer and use it in GitHub Desktop.
Benchmark domain name lookups
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