Return-Path: 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; 'skip:[ 20': 0.03; 'string.': 0.04; 'subject:Python': 0.05; 'repeated': 0.07; 'called.': 0.09; 'dict': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'regression': 0.09; 'reports.': 0.09; 'separately': 0.09; 'terry': 0.09; 'stored': 0.10; '3.3.': 0.16; 'desktop.': 0.16; 'operation,': 0.16; 'pentium': 0.16; 'posted,': 0.16; 'reason.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'processor': 0.17; 'jan': 0.18; 'tests': 0.18; '>>>': 0.18; 'windows': 0.19; 'feb': 0.19; '3.2': 0.22; 'constant': 0.22; 'object.': 0.22; 'operations.': 0.22; 'example': 0.23; 'this:': 0.23; 'seems': 0.23; 'command': 0.24; 'machine': 0.24; '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; 'overhead': 0.29; 'probably': 0.29; 'function': 0.30; 'code': 0.31; 'gets': 0.32; 'system,': 0.32; 'running': 0.32; 'idle': 0.33; 'problem': 0.33; 'to:addr :python-list': 0.33; 'christian': 0.34; 'pm,': 0.35; 'similar': 0.35; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'should': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'notice': 0.39; 'space': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'lower': 0.61; 'first': 0.61; 'ever': 0.63; 'times': 0.63; 'more': 0.63; 'within': 0.64; 'results': 0.65; '8bit%:21': 0.69; 'sounds': 0.71; 'saving': 0.72; '2013': 0.84; 'difference.': 0.84; 'received:fios.verizon.net': 0.84; 'traded': 0.84; 'same,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Python Speed Date: Wed, 27 Feb 2013 21:11:25 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362017506 news.xs4all.nl 6949 [2001:888:2000:d::a6]:56871 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:40095 On 2/27/2013 7:15 PM, Ian Kelly wrote: > On Wed, Feb 27, 2013 at 3:24 PM, Terry Reedy wrote: >>> Py33 >>>>>> timeit.repeat("{1:'abc=C3=A9=C5=93=E2=82=AC'}") >>> [0.2573893570572636, 0.24261832285651508, 0.24259548003601594] >> >> On my win system, I get a lower time for this: >> [0.16579443757208878, 0.1475787649924598, 0.14970205670637426] >> >>> Py323 >>> timeit.repeat("{1:'abc=C3=A9=C5=93=E2=82=AC'}") >>> [0.11000708521282831, 0.0994753634273593, 0.09901023634051853] >> >> While I get the same time for 3.2.3. >> [0.11759353304428544, 0.09482448029000068, 0.09532802044164157] >> >> It seems that something about Jim's machine does not like 3.3. >> *nix will probably see even less of a difference. Times are in microse= conds, >> so few programs will ever notice the difference. > > Running the same tests in IDLE on my Windows XP laptop, I see similar > results to what jmf reports. Whereas I run win 7 on a pentium i7 desktop. For this, I suspect the=20 processor difference more than the OS. To really investigate, one should = separately time string creation from dict creation with a pre-built strin= g. repeat('pass') # .013 to .02 on both repeat("'abc=C3=A9=C5=93=E2=82=AC'") # same, untimeable repeat("'abc=C3=A9=C5=93=E2=82=AC'*10") # .12 versus .14 on 3.2 and 3.3 repeat("{1:s}", "s=3D'abc=C3=A9=C5=93=E2=82=AC'") # .10 versus .14 There is a problem with timer overhead for sub-microsecond operations.=20 In interactive use, the code is compiled within a function that gets=20 called. The string 'abc=C3=A9=C5=93=E2=82=AC' should be stored as a const= ant in the code=20 object. To force repeated string operation, one should either time from=20 command line or do an operation, as with the example above. I notice=20 that the first of 3 times is almost always higher for some reason. > But from what Christian posted, it > sounds like this regression may have more to do with PEP 412 than PEP > 393. That change traded a space saving and for a small initial time cost. Christian also showed that initial cost has since been cut. There may be = more internal dict tweaks before 3.4. --=20 Terry Jan Reedy