Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10077
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!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.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '3.2': 0.05; 'sure.': 0.05; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'statement.': 0.09; 'double-quote': 0.16; 'expected,': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'linux).': 0.16; 'mistake.': 0.16; '"python': 0.16; 'processor': 0.16; 'this:': 0.16; 'switched': 0.19; 'loop': 0.22; 'maybe': 0.22; 'header:In-Reply- To:1': 0.22; '(on': 0.23; 'literal': 0.23; 'way?': 0.23; 'subject:Question': 0.25; 'handles': 0.25; 'noticed': 0.26; 'windows': 0.26; 'mode': 0.28; 'received:84': 0.28; 'server': 0.29; 'around.': 0.29; 'stefan': 0.29; 'second': 0.29; 'ran': 0.30; 'it.': 0.33; 'skip:" 20': 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'someone': 0.34; 'post': 0.34; "can't": 0.34; 'test': 0.34; 'statement,': 0.35; 'running': 0.35; 'explain': 0.36; 'but': 0.37; 'using': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'two': 0.38; 'run': 0.39; 'common': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'your': 0.60; 'power': 0.62; 'time?': 0.73; '100000': 0.84; 'surround': 0.84; 'swap': 0.84; '2003.': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Stefan Behnel <stefan_ml@behnel.de> |
| Subject | Re: Question about timeit |
| Date | Fri, 22 Jul 2011 08:37:11 +0200 |
| References | <j0b41p$krj$1@dough.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | dslb-084-056-019-190.pools.arcor-ip.net |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Lightning/1.0b2 Thunderbird/3.1.11 |
| In-Reply-To | <j0b41p$krj$1@dough.gmane.org> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1350.1311316646.1164.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1311316646 news.xs4all.nl 23936 [2001:888:2000:d::a6]:35753 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10077 |
Show key headers only | View raw
Frank Millman, 22.07.2011 08:06:
> I mentioned in a recent post that I noticed an inconsistency in timeit, and
> then reported that I must have made a mistake.
>
> I have now identified my problem, but I don't understand it.
>
> C:\Python32\Lib>timeit.py "int(float('165.0'))"
> 100000 loops, best of 3: 3.52 usec per loop
>
> C:\Python32\Lib>timeit.py "int(float('165.0'))"
> 100000 loops, best of 3: 3.51 usec per loop
>
> C:\Python32\Lib>timeit.py 'int(float("165.0"))'
> 10000000 loops, best of 3: 0.0888 usec per loop
>
> C:\Python32\Lib>timeit.py 'int(float("165.0"))'
> 10000000 loops, best of 3: 0.0887 usec per loop
>
> I ran them both twice just to be sure.
>
> The first two use double-quote marks to surround the statement, and
> single-quote marks to surround the literal inside the statement.
>
> The second two swap the quote marks around.
>
> Can someone explain the difference?
>
> I am using python 3.2 on Windows Server 2003.
As expected, I can't reproduce this (on Linux). Maybe your processor
switched from power save mode to performance mode right after running the
test a second time? Or maybe you need a better console application that
handles quotes in a more obvious way?
Note that it's common to run timeit like this: "python -m timeit".
Stefan
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Question about timeit Stefan Behnel <stefan_ml@behnel.de> - 2011-07-22 08:37 +0200
Re: Question about timeit Frank Millman <frank@chagford.com> - 2011-07-21 23:59 -0700
Re: Question about timeit Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-22 10:08 +0200
Re: Question about timeit Stefan Behnel <stefan_ml@behnel.de> - 2011-07-22 10:34 +0200
Re: Question about timeit Frank Millman <frank@chagford.com> - 2011-07-22 05:30 -0700
Re: Question about timeit Thomas Jollans <t@jollybox.de> - 2011-07-22 14:43 +0200
Re: Question about timeit Frank Millman <frank@chagford.com> - 2011-07-22 23:30 -0700
csiph-web