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


Groups > comp.lang.python > #73704

Re: print statements and profiling a function slowed performance

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'say,': 0.05; 'sys': 0.07; '%s"': 0.09; 'executed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'windows': 0.15; '(about': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'obviously': 0.18; 'import': 0.22; 'print': 0.22; 'url:home': 0.24; 'fairly': 0.24; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'chris': 0.29; 'quickly': 0.29; '(maybe': 0.31; 'skip:c 30': 0.32; 'fri,': 0.33; 'core': 0.34; 'but': 0.35; 'in:': 0.36; 'skip:> 10': 0.36; 'doing': 0.36; 'charset:us-ascii': 0.36; 'seconds': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'took': 0.61; 'simple': 0.61; "you'll": 0.62; 'more': 0.64; 'feelings': 0.91; 'received:108': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: print statements and profiling a function slowed performance
Date Sat, 28 Jun 2014 09:41:02 -0400
Organization IISS Elusive Unicorn
References <d5d8cea5-c4c9-42c4-865f-9efe33b162ed@googlegroups.com> <mailman.11265.1403810111.18130.python-list@python.org> <bd29ac07-f93d-4b59-8c5b-78e5ce8b6e4c@googlegroups.com> <CAPTjJmrw4XK8pXfgWCH_GRTJGa3cF+PiC3Hp2qJ2peQnic-d4g@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-79-220-208.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Newsgroups comp.lang.python
Message-ID <mailman.11307.1403962872.18130.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403962872 news.xs4all.nl 2926 [2001:888:2000:d::a6]:53829
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73704

Show key headers only | View raw


On Fri, 27 Jun 2014 12:06:54 +1000, Chris Angelico <rosuav@gmail.com>
declaimed the following:

>
>If x is, say, range(1000000), a simple "for foo in x: pass" will
>complete fairly quickly (maybe 100ms on my computer), while the
>progress-indicated loop will take much longer (about 30 seconds when I
>tried it). Obviously you'll be doing more work than just "pass", but

	I take it those are subjective feelings of time...


C:\Users\Wulfraed\Documents>script1.py
Executed in: 0.0352086402164
Executed in: 57.0624450629

C:\Users\Wulfraed\Documents>type script1.py
import sys
import time

#   Python 2.7, Windows 7-64, Core i7-3770 3.4GHz, 12GB

x = range(1000000)

start = time.clock()
for i in x:
    pass
took = time.clock() - start
print "Executed in: %s" % (took)

start = time.clock()
for i in x:
    sys.stdout.write("%s\r" % i)
took = time.clock() - start
print "Executed in: %s" % (took)
C:\Users\Wulfraed\Documents>


	35mSec vs 57Sec

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

print statements and profiling a function slowed performance CM <cmpython@gmail.com> - 2014-06-26 11:44 -0700
  Re: print statements and profiling a function slowed performance Michael Torrie <torriem@gmail.com> - 2014-06-26 13:14 -0600
    Re: print statements and profiling a function slowed performance CM <cmpython@gmail.com> - 2014-06-26 13:36 -0700
      Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-27 12:06 +1000
      Re: print statements and profiling a function slowed performance Michael Torrie <torriem@gmail.com> - 2014-06-26 19:59 -0600
      Re: print statements and profiling a function slowed performance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-28 09:41 -0400
      Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-28 23:50 +1000
      Re: print statements and profiling a function slowed performance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-29 02:14 -0400
      Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-29 17:14 +1000
  Re: print statements and profiling a function slowed performance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-26 20:27 +0100
    Re: print statements and profiling a function slowed performance CM <cmpython@gmail.com> - 2014-06-26 13:37 -0700
      Re: print statements and profiling a function slowed performance Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-27 02:55 +0000
        Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-27 13:14 +1000
        Re: print statements and profiling a function slowed performance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-27 16:55 +0100
        Re: print statements and profiling a function slowed performance Skip Montanaro <skip@pobox.com> - 2014-06-27 11:05 -0500
        Re: print statements and profiling a function slowed performance Ian Kelly <ian.g.kelly@gmail.com> - 2014-06-27 15:35 -0600
        Re: print statements and profiling a function slowed performance Skip Montanaro <skip@pobox.com> - 2014-06-27 19:12 -0500
        Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-28 10:29 +1000
          Re: print statements and profiling a function slowed performance Marko Rauhamaa <marko@pacujo.net> - 2014-06-28 22:20 +0300
            Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-29 09:30 +1000
            Re: print statements and profiling a function slowed performance Rustom Mody <rustompmody@gmail.com> - 2014-06-28 19:25 -0700
              Re: print statements and profiling a function slowed performance Chris Angelico <rosuav@gmail.com> - 2014-06-29 12:32 +1000
        Re: print statements and profiling a function slowed performance Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-28 02:06 +0100
  Re: print statements and profiling a function slowed performance Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-26 22:11 -0400

csiph-web