reference:
http://blog.csdn.net/flynetcn/archive/2009/01/08/3733574.aspx
cost time:24s
('202.108.33.94', 0) 625
('202.108.33.77', 0) 625
('202.108.33.70', 0) 625
('202.108.33.95', 0) 625
('202.108.33.74', 0) 625
('202.108.33.78', 0) 625
('202.108.33.71', 0) 625
('202.108.33.96', 0) 625
('202.108.33.75', 0) 625
('202.108.33.98', 0) 625
('202.108.33.79', 0) 625
('202.108.33.76', 0) 625
('202.108.33.72', 0) 625
('202.108.33.97', 0) 625
('202.108.33.99', 0) 625
('202.108.33.73', 0) 625
#!usr/bin/env python
#encoding=utf8
"""
test dns parser cost time
"""
import sys,socket
from datetime import datetime
s=datetime.now()
#result=socket.getaddrinfo("www.sina.com.cn",None)
dict={}
for i in xrange(0,10000):
result=socket.getaddrinfo("www.sina.com.cn",None)
result=result[0][4]
if result not in dict:
dict[result]=1
else:
dict[result]=dict[result]+1
#this is error
#result=socket.getaddrinfo("http://www.china-pub.com/1902284",None)
#resut=socket.gethostbyname("www.sina.com.cn")
e=datetime.now()
print "cost time:%ss"%(e-s).seconds
#print result[0][4]
#print "haah"
for k,v in dict.iteritems():
print k,v
http://blog.csdn.net/flynetcn/archive/2009/01/08/3733574.aspx
cost time:24s
('202.108.33.94', 0) 625
('202.108.33.77', 0) 625
('202.108.33.70', 0) 625
('202.108.33.95', 0) 625
('202.108.33.74', 0) 625
('202.108.33.78', 0) 625
('202.108.33.71', 0) 625
('202.108.33.96', 0) 625
('202.108.33.75', 0) 625
('202.108.33.98', 0) 625
('202.108.33.79', 0) 625
('202.108.33.76', 0) 625
('202.108.33.72', 0) 625
('202.108.33.97', 0) 625
('202.108.33.99', 0) 625
('202.108.33.73', 0) 625
#!usr/bin/env python
#encoding=utf8
"""
test dns parser cost time
"""
import sys,socket
from datetime import datetime
s=datetime.now()
#result=socket.getaddrinfo("www.sina.com.cn",None)
dict={}
for i in xrange(0,10000):
result=socket.getaddrinfo("www.sina.com.cn",None)
result=result[0][4]
if result not in dict:
dict[result]=1
else:
dict[result]=dict[result]+1
#this is error
#result=socket.getaddrinfo("http://www.china-pub.com/1902284",None)
#resut=socket.gethostbyname("www.sina.com.cn")
e=datetime.now()
print "cost time:%ss"%(e-s).seconds
#print result[0][4]
#print "haah"
for k,v in dict.iteritems():
print k,v