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


Groups > comp.lang.python > #73725

Re: print statements and profiling a function slowed performance

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'windows,': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'aggressively': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterable': 0.16; 'iterator': 0.16; 'range,': 0.16; 'xrange': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'figures': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'convenient': 0.24; 'cc:2**0': 0.24; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'closer': 0.31; 'os,': 0.31; 'run': 0.32; 'quite': 0.32; 'open': 0.33; 'linux': 0.33; 'comment': 0.34; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'ram': 0.36; 'so,': 0.37; 'list': 0.37; 'pm,': 0.38; 'rather': 0.38; 'reported': 0.39; 'skip:u 10': 0.60; 'times': 0.62; 'between': 0.67; 'console,': 0.84; 'etc,': 0.84; 'worth,': 0.84; 'to:none': 0.92; 'differences': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=CA7SmpAyf3/IdhKgZ7JJWEHWfx2HBYiZ0hc83L99Rgk=; b=BaGN2fz7yZE13vVymExdfDNJ5IIz0epCdCt5+HcUoSJmmCMTYEs6sCL8RfLg/ZPhB6 u/9B7RzcnTZ2XcrrFtTzC7nYm8nGs1ay0RRZ+9TjxrhA7FJDXMzK0tAD5cTvUQe4gN9J StLvYQ1IgpR55u16ZaFYg+Lysp8ce2o04VEsjsljmyfw2P/2hCyuyXfGim9L3dnJFLld EaMI18qTAeQnFJRo9OOTkX7p53L+qQj/AVyKHsNT9nt6RUj93ZjLpqAnQKz8mQp4G5n1 2/3fcvyiUdUzEiF0fbGGp2ZhzL3yLClwh81P2aJsvnh7VeW7hmKwYXljfmS0UTqNTrnj q/Vg==
MIME-Version 1.0
X-Received by 10.58.198.67 with SMTP id ja3mr28265602vec.10.1404026041898; Sun, 29 Jun 2014 00:14:01 -0700 (PDT)
In-Reply-To <vfbvq95iupa1ispnqhkq7vjvanrvm8abt7@4ax.com>
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> <5bhtq95qm64rtt8vqbne1ms87t793ab958@4ax.com> <CAPTjJmrMFac0nK0kTrsbjFP-yC76URbPk5Wu0CR4j5wqBLWZnQ@mail.gmail.com> <vfbvq95iupa1ispnqhkq7vjvanrvm8abt7@4ax.com>
Date Sun, 29 Jun 2014 17:14:01 +1000
Subject Re: print statements and profiling a function slowed performance
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
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.11322.1404026045.18130.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1404026045 news.xs4all.nl 2955 [2001:888:2000:d::a6]:60910
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73725

Show key headers only | View raw


On Sun, Jun 29, 2014 at 4:14 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Sat, 28 Jun 2014 23:50:26 +1000, Chris Angelico <rosuav@gmail.com>
> declaimed the following:
>
>>No, they were measured; but the exact difference will depend on Python
>>version, console, OS, etc, etc, etc, etc, etc, which is why I said
>>"maybe 100ms" - on one run it was about that (rounded aggressively to
>>make for convenient figures), but if I ran the test again, it might
>>come out at 50ms or 200ms. For what it's worth, I did the test on
>>Python 3.5(ish) on Linux; since you tested it on Python 2, a closer
>>comparison would be to use xrange rather than range, to avoid the RAM
>>overhead.
>>
>
>         I chose range() in order to reuse the list (generated outside the
> timing), rather than include the time of the iterator on both loops.
>
>         Ran it three times and only had differences in the noise.
>
>         The main incentive for my "subjective" comment is that I was getting a
> do-nothing loop that was ~half the time you reported, while the print #
> loop was ~twice your reported times.

My original point (printing to console can be quite slow) is supported
by your figures just as much as it is by mine; but the difference
between them is unsurprising, given the number of differences in the
test (list vs iterable range, Linux vs Windows, Py2 vs Py3). So, not
subjective, but still open to huge variation.

ChrisA

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