Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107992

Re: Fastest way to retrieve and write html contents to file

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Stephen Hansen <me+python@ixokai.io>
Newsgroups comp.lang.python
Subject Re: Fastest way to retrieve and write html contents to file
Date Sun, 01 May 2016 23:27:32 -0700
Lines 29
Message-ID <mailman.308.1462170455.32212.python-list@python.org> (permalink)
References <ng6jie$1ap$1@dont-email.me> <85vb2xgj2i.fsf@benfinney.id.au> <mailman.298.1462164614.32212.python-list@python.org> <ng6mn7$8nv$1@dont-email.me> <1462166136.1167243.595273897.291B0865@webmail.messagingengine.com> <mailman.303.1462166138.32212.python-list@python.org> <ng6q67$gnm$1@dont-email.me> <1462170452.1180117.595306673.68B64F02@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de IwVJKApv9zPKERMJRVKSewsWAZp6t3UZRXHAk6cn28Mw==
Return-Path <me+python@ixokai.io>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'skip:% 20': 0.07; 'subject:file': 0.07; 'urllib2': 0.07; 'received:internal': 0.09; 'slow.': 0.09; 'size,': 0.13; '10:59': 0.16; 'dfs': 0.16; 'enough.': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'comparing': 0.18; 'otherwise,': 0.20; 'constant': 0.22; 'stephen': 0.22; 'file.': 0.22; 'demonstrate': 0.23; "haven't": 0.24; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'skip:u 20': 0.28; "i'm": 0.30; 'print': 0.30; 'point': 0.33; 'downloading': 0.33; 'file': 0.34; 'but': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'two': 0.37; 'seem': 0.37; 'difference': 0.38; 'received:66': 0.38; 'to:addr:python.org': 0.40; "you'll": 0.61; 'header:Message- Id:1': 0.61; 'back': 0.62; 'believe': 0.66; 'of:': 0.66; 'answered,': 0.84; 'meg': 0.84; 'subject:write': 0.84; 'toy': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=ixokai.io; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=86eYIhdR67KWAzbiEh3nuF+A4CQ=; b=MOrMoU z0iIYxFLUO1HqfoYQtfq6NF2gCYgbdNiZIOnx1f0O5Inn/GaKOskurzLVWmn0dn3 YJLgpp/O9js3ynzfnsZp8F7pTfbaGd6pxHevRqX7QG7n7BVLFz+SAIsrdHniSlrH sC8GQfZxSpzv3ABtT8QZZFvpPBWsqnXcDKFb8=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=86eYIhdR67KWAzb iEh3nuF+A4CQ=; b=YkzgwaZt+VVhInsASHSRe2FRVO8glalbHbKQY0ciBQrkBZZ 6XR7626sLBaHpigtv2AENwvtkU8LpJuf/oMWi3/ehrmQEzqgNHErG8DRqFqfkw8N ljU/LFN94xnHJHTkN+hvbuCpghnXuDogSu0tnHhBsHc2AnfALPBdFqGzI9Wg=
X-Sasl-Enc pcntRd7sVk7XEXNnD8IzCbI9q53rQP1HT0eJfk904Sjp 1462170452
X-Mailer MessagingEngine.com Webmail Interface - ajax-491eb5a4
In-Reply-To <ng6q67$gnm$1@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <1462170452.1180117.595306673.68B64F02@webmail.messagingengine.com>
X-Mailman-Original-References <ng6jie$1ap$1@dont-email.me> <85vb2xgj2i.fsf@benfinney.id.au> <mailman.298.1462164614.32212.python-list@python.org> <ng6mn7$8nv$1@dont-email.me> <1462166136.1167243.595273897.291B0865@webmail.messagingengine.com> <mailman.303.1462166138.32212.python-list@python.org> <ng6q67$gnm$1@dont-email.me>
Xref csiph.com comp.lang.python:107992

Show key headers only | View raw


On Sun, May 1, 2016, at 10:59 PM, DFS wrote:
> startTime = time.clock()        
> for i in range(loops):
> 	r = urllib2.urlopen(webpage)
> 	f = open(webfile,"w")
> 	f.write(r.read())
> 	f.close
> endTime = time.clock()          
> print "Finished urllib2 in %.2g seconds" %(endTime-startTime)

Yeah on my system I get 1.8 out of this, amounting to 0.18s. 

I'm again going back to the point of: its fast enough. When comparing
two small numbers, "twice as slow" is meaningless.

You have an assumption you haven't answered, that downloading a 10 meg
file will be twice as slow as downloading this tiny file. You haven't
proven that at all. 

I suspect you have a constant overhead of X, and in this toy example,
that makes it seem twice as slow. But when downloading a file of size,
you'll have the same constant factor, at which point the difference is
irrelevant. 

If you believe otherwise, demonstrate it.

-- 
Stephen Hansen
  m e @ i x o k a i . i o

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 00:06 -0400
  Re: Fastest way to retrieve and write html contents to file Stephen Hansen <me+python@ixokai.io> - 2016-05-01 21:34 -0700
  Re: Fastest way to retrieve and write html contents to file Chris Angelico <rosuav@gmail.com> - 2016-05-02 14:40 +1000
    Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 00:50 -0400
      Re: Fastest way to retrieve and write html contents to file Stephen Hansen <me+python@ixokai.io> - 2016-05-01 22:00 -0700
        Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 01:04 -0400
          Re: Fastest way to retrieve and write html contents to file Chris Angelico <rosuav@gmail.com> - 2016-05-02 15:12 +1000
          Re: Fastest way to retrieve and write html contents to file Stephen Hansen <me+python@ixokai.io> - 2016-05-01 22:17 -0700
          Re: Fastest way to retrieve and write html contents to file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-02 15:57 +1000
  Re: Fastest way to retrieve and write html contents to file Ben Finney <ben+python@benfinney.id.au> - 2016-05-02 14:49 +1000
    Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 01:00 -0400
      Re: Fastest way to retrieve and write html contents to file Stephen Hansen <me+python@ixokai.io> - 2016-05-01 22:15 -0700
        Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 01:59 -0400
          Re: Fastest way to retrieve and write html contents to file Stephen Hansen <me+python@ixokai.io> - 2016-05-01 23:27 -0700
            Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 03:37 -0400
              Re: Fastest way to retrieve and write html contents to file Stephen Hansen <me+python@ixokai.io> - 2016-05-02 00:58 -0700
              Re: Fastest way to retrieve and write html contents to file Michael Torrie <torriem@gmail.com> - 2016-05-02 22:06 -0600
                Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-03 00:24 -0400
                Re: Fastest way to retrieve and write html contents to file Tim Chase <python.list@tim.thechases.com> - 2016-05-03 10:28 -0500
                Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-03 13:00 -0400
                Re: Fastest way to retrieve and write html contents to file Tim Chase <python.list@tim.thechases.com> - 2016-05-03 13:41 -0500
                Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-04 02:10 -0400
      Re: Fastest way to retrieve and write html contents to file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-05-02 16:05 +1000
        Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 02:47 -0400
          Re: Fastest way to retrieve and write html contents to file Chris Angelico <rosuav@gmail.com> - 2016-05-02 17:19 +1000
            Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 21:51 -0400
              Re: Fastest way to retrieve and write html contents to file Chris Angelico <rosuav@gmail.com> - 2016-05-03 12:00 +1000
                Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 22:01 -0400
          Re: Fastest way to retrieve and write html contents to file Peter Otten <__peter__@web.de> - 2016-05-02 10:42 +0200
            Re: Fastest way to retrieve and write html contents to file DFS <nospam@dfs.com> - 2016-05-02 21:52 -0400
  Re: Fastest way to retrieve and write html contents to file Chris Angelico <rosuav@gmail.com> - 2016-05-02 14:53 +1000
  Re: Fastest way to retrieve and write html contents to file Tim Chase <python.list@tim.thechases.com> - 2016-05-02 07:38 -0500

csiph-web