Skip to content

Instantly share code, notes, and snippets.

@yeonsh
Created March 7, 2014 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yeonsh/9406018 to your computer and use it in GitHub Desktop.
Save yeonsh/9406018 to your computer and use it in GitHub Desktop.
import os
import tldextract
from tld import get_tld
from tld.utils import update_tld_names
TEST_COUNT = 1000000
start_time = os.times()[4]
for i in range(TEST_COUNT):
e = tldextract.extract('http://forums.news.cnn.com:8080/a/b/c/')
d = e.domain + '.' + e.suffix
#print d
finish_time = os.times()[4]
print finish_time - start_time
start_time = os.times()[4]
update_tld_names()
for i in range(TEST_COUNT):
d = get_tld('http://forums.news.cnn.com:8080/a/b/c/')
#print d
finish_time = os.times()[4]
print finish_time - start_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment