Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 102 lines (85 sloc) 2.628 kB
222f924 @weppos Add benchmark
authored
1 require 'benchmark'
2
3 if ARGV[0].nil? || ARGV[0] == "current"
4 $:.unshift(File.dirname(__FILE__) + '/../lib')
5 else
6 require 'rubygems'
7 gem 'whois', ARGV[0]
8 end
9
10 require 'whois'
e94d872 @weppos Rename Whois::Answer to Whois::Record
authored
11 require 'whois/record/parser/whois.nic.it'
222f924 @weppos Add benchmark
authored
12
13 TIMES = ARGV[1] || 100_000
14 BLANK, PRESENT = DATA.read.to_s.split("<!--more-->")
15
e94d872 @weppos Rename Whois::Answer to Whois::Record
authored
16 PBLANK = Whois::Record::Parser::WhoisNicIt.new(Whois::Record::Part.new(BLANK, "whois.nic.it"))
17 PPRESENT = Whois::Record::Parser::WhoisNicIt.new(Whois::Record::Part.new(PRESENT, "whois.nic.it"))
222f924 @weppos Add benchmark
authored
18
19 Benchmark.bmbm do |x|
20 x.report("supported with value") do
21 TIMES.times do
22 PPRESENT.created_on
23 end
24 end
25 x.report("supported without value") do
26 TIMES.times do
27 PPRESENT.created_on
28 end
29 end
30 x.report("not supported") do
31 TIMES.times do
32 PPRESENT.domain_id rescue nil
33 end
34 end
35
e94d872 @weppos Rename Whois::Answer to Whois::Record
authored
36 Whois::Record::Parser::PROPERTIES.each do |property|
222f924 @weppos Add benchmark
authored
37 x.report("property #{property}") do
38 TIMES.times do
39 PPRESENT.send(property) rescue nil
40 end
41 end
42 end
43 end
44
45
46 __END__
47
48
49 *********************************************************************
50 * Please note that the following result could be a subgroup of *
51 * the data contained in the database. *
52 * *
53 * Additional information can be visualized at: *
54 * http://www.nic.it/cgi-bin/Whois/whois.cgi *
55 *********************************************************************
56
57 Domain: google.it
58 Status: ACTIVE
59 Created: 1999-12-10 00:00:00
60 Last Update: 2008-11-27 16:47:22
61 Expire Date: 2009-11-27
62
63 Registrant
64 Name: Google Ireland Holdings
65 ContactID: GOOG175-ITNIC
66 Address: 30 Herbert Street
67 Dublin
68 2
69 IE
70 IE
71 Created: 2008-11-27 16:47:22
72 Last Update: 2008-11-27 16:47:22
73
74 Admin Contact
75 Name: Tsao Tu
76 ContactID: TT4277-ITNIC
77 Organization: Tu Tsao
78 Address: 30 Herbert Street
79 Dublin
80 2
81 IE
82 IE
83 Created: 2008-11-27 16:47:22
84 Last Update: 2008-11-27 16:47:22
85
86 Technical Contacts
87 Name: Technical Services
88 ContactID: TS7016-ITNIC
89
90 Registrar
91 Organization: Register.it s.p.a.
92 Name: REGISTER-MNT
93
94 Nameservers
95 ns1.google.com
96 ns4.google.com
97 ns2.google.com
98 ns3.google.com
99 <!--more-->
100 Domain: google.it
101 Status: AVAILABLE
Something went wrong with that request. Please try again.