Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40121
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!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.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; '(python': 0.05; 'cache': 0.05; 'repeated': 0.07; 'called.': 0.09; 'empty,': 0.09; 'meaningful': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'runs,': 0.09; 'terry': 0.09; 'stored': 0.10; 'slightly': 0.15; 'caches': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'iteration': 0.16; 'operation,': 0.16; 'pipelines': 0.16; 'reason.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'reedy': 0.16; 'runtime.': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'stefan': 0.17; 'feb': 0.19; 'changes': 0.20; 'constant': 0.22; 'object.': 0.22; 'operations.': 0.22; 'runs': 0.22; 'example': 0.23; 'command': 0.24; 'testing': 0.24; 'pass': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'compiled': 0.27; 'header:X-Complaints-To:1': 0.28; 'initial': 0.28; 'run': 0.28; 'cpu': 0.29; 'overhead': 0.29; 'steven': 0.29; 'subsequently': 0.29; 'starts': 0.29; 'usually': 0.30; 'function': 0.30; 'code': 0.31; 'gets': 0.32; 'running': 0.32; 'problem': 0.33; 'to:addr :python-list': 0.33; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'should': 0.36; 'enough': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'notice': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'time,': 0.62; 'expert': 0.62; 'repeat': 0.62; 'warm': 0.62; 'times': 0.63; 'more': 0.63; 'within': 0.64; 'results': 0.65; 'overall': 0.66; '2013': 0.84; 'received:87.139': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Stefan Behnel <stefan_ml@behnel.de> |
| Subject | Re: Python Speed |
| Date | Thu, 28 Feb 2013 08:55:50 +0100 |
| References | <kgm12e$vus$1@ger.gmane.org> <CALwzidnP03kuTMPw_wnknG_CvbuWBHkR2JWZ7Xs3pVyZHntWCg@mail.gmail.com> <mailman.2633.1362017506.2939.python-list@python.org> <512f01af$0$30001$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | p578ba676.dip0.t-ipconnect.de |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 |
| In-Reply-To | <512f01af$0$30001$c3e8da3$5496439d@news.astraweb.com> |
| 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 | <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.2643.1362038393.2939.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362038393 news.xs4all.nl 6859 [2001:888:2000:d::a6]:43983 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40121 |
Show key headers only | View raw
Steven D'Aprano, 28.02.2013 08:05: > On Wed, 27 Feb 2013 21:11:25 -0500, Terry Reedy wrote: > >> There is a problem with timer overhead for sub-microsecond operations. >> In interactive use, the code is compiled within a function that gets >> called. The string 'abc需' should be stored as a constant in the code >> object. To force repeated string operation, one should either time from >> command line or do an operation, as with the example above. I notice >> that the first of 3 times is almost always higher for some reason. > > I am not an expert on this, but I suspect the problem may have something > to do with CPU pipelines and cache. The first time the timer runs, the > cache is empty, and you get a slightly higher time. Subsequently there > are not as many CPU cache misses, and the code runs more quickly. Well, the default loop iteration count is 1000000, so warming up any caches might make a little difference at the very beginning but should rarely have a major impact on the overall running time, as each iteration only changes the final result by 1/1000000 of its runtime. However, it's best to run timeit as a main program (python -m timeit), because the way it works then is that it first runs the code a couple of times to see how often it should repeat it in a loop to get meaningful results. Only *then* it starts benchmarking it. That initial testing phase should usually be enough to warm up any caches, so that you'd get better results. You can still get the results of all repeated runs if you pass -v. Stefan
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Python Speed Terry Reedy <tjreedy@udel.edu> - 2013-02-27 21:11 -0500
Re: Python Speed Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-28 07:05 +0000
Re: Python Speed Stefan Behnel <stefan_ml@behnel.de> - 2013-02-28 08:55 +0100
csiph-web