urllib slower than browser to access html
Question: The following python script takes 3 seconds on my PC to load the source code
of a twitter page, which is much higher than it takes to retrieve the source
code of other websites, such as youtube. When I load the same twitter page in
my browser, the "network" tab in google chrome tells me the html is retrieved
in 0.3 seconds.

Why is urllib so much slower than my browser?

    
    
    import urllib2
    import time
    
    start=time.time()
    channel='pontifex'
    url="https://twitter.com/"+channel
    page = urllib2.urlopen(url).read()
    print str(round(time.time()-start,0))+" secs total"
    


Answer: Caching is the answer and it presents itself in the form of preloading which
is what most browsers these days do. If not the browser, then search engines
such as Google also cache frequently visited websites so that retrieving them
is only a matter of milliseconds

See this post: [How can Google be so
fast?](http://stackoverflow.com/questions/132359/how-can-google-be-so-fast)

