Received: by 10.180.107.38 with SMTP id gz6mr1590438wib.0.1350183565844; Sat, 13 Oct 2012 19:59:25 -0700 (PDT) Path: q10ni65116189wif.0!nntp.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin2!goblin1!goblin.stu.neva.ru!news2.euro.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-l...@python.org Delivered-To: python-l...@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.03; 'true,': 0.04; 'binary': 0.05; 'removes': 0.05; 'python': 0.09; 'argument,': 0.09; 'portions': 0.09; 'terry': 0.09; 'cc:addr :python-list': 0.10; "wouldn't": 0.11; 'subject:python': 0.11; 'assume': 0.11; '"from': 0.16; '3.2.': 0.16; 'reedy': 0.16; 'string': 0.17; 'wrote:': 0.17; 'byte': 0.17; '>>>': 0.18; 'import': 0.21; 'claimed': 0.22; 'converted': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'converting': 0.27; "doesn't": 0.28; 'author,': 0.29; 'decimal': 0.29; 'factor': 0.29; 'overhead': 0.29; "i'm": 0.29; 'usually': 0.30; 'code': 0.31; 'curious': 0.33; 'doubt': 0.33; 'largely': 0.33; 'right?': 0.33; 'point.': 0.33; 'whatever': 0.35; 'faster': 0.35; 'pm,': 0.35; 'really': 0.36; 'but': 0.36; 'should': 0.36; 'skip:t 40': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'end': 0.40; 'sincerely': 0.60; 'spending': 0.61; 'within': 0.64; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'subjectcharset:utf-8': 0.72; '100': 0.78; 'subject:get': 0.81; 'float,': 0.84; 'subject:value': 0.84; 'ratio': 0.91; 'angel': 0.93 Date: Mon, 08 Oct 2012 22:20:23 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Terry Reedy Subject: =?UTF-8?B?UmU6IFRvIGdldCB0aGUgYWNjdXJhdGUgdmFsdWUgb2YgMSAtIDAuOTk=?= =?UTF-8?B?OTk5OTk5OTk5OTk5OSAsaG93IHRvIGltcGxlbWVudCB0aGUgcHl0aG9uIGFsZ28=?= =?UTF-8?B?cml0aG0g77yf?= References: <91ff9b33-c212-4be0-8ed0-1f6b16f56865@googlegroups.com> <5072E7CC.2070...@davea.name> <5072EDA6.6040...@davea.name> In-Reply-To: X-Provags-ID: V02:K0:3K+EF/4Yjb2zRGF925p+uAUeYu+2qtK3RnuMRdNZy9i cDNOOp/enCBd7AupJb7ZNw34oEF9oqeAkzRke08Msn9n7i4Z5k pKRpqVsHweFy3PPB1kU7gPpgBGIlRSz362LNUhfTK0VGQ0dBLg 1S9mPc79b8MM7AsASSMKsH+1eQg5RAe3GZlQr49azowAb6pPwq gNjvR5zsX6pyDUCWt2Ea6rMgGEf/WDJP4CnT5DXr2Fx5GLlNcI LExNKizNoctFS7CieLw1ikhbAa9u9trk3C655xR7qh2UMu0lt5 bEGgKZcpKWDl0ndxjKxuNthBuK7Iefiq13xFnV9Aslr1RX4Mg= = Cc: python-l...@python.org X-BeenThere: python-l...@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d...@davea.name 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349749259 news.xs4all.nl 6905 [2001:888:2000:d::a6]:38400 X-Complaints-To: ab...@xs4all.nl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 10/08/2012 09:45 PM, Terry Reedy wrote: > On 10/8/2012 11:13 AM, Dave Angel wrote: > >>> Isn't it true, though, that Python 3.3 has a completely new >>> implementation of decimal that largely removes this disadvantage? > >> I wouldn't know, I'm on 3.2. However, I sincerely doubt if it's within >> a factor of 100 of the speed of the binary float, at least on > > >>> import timeit as tt > >>> tt.repeat("float('1.0')-float('0.9999999999')") > [0.6856039948871151, 0.669049830953858, 0.668688006423692] > >>> tt.repeat("Decimal('1.0')-Decimal('0.9999999999')", "from decimal > import Decimal") > [1.3204655578092428, 1.286977575486688, 1.2893188292009938] > > >>> tt.repeat("a-b", "a = 1.0; b=0.9999999999") > [0.06100386171601713, 0.044538539999592786, 0.04451548406098027] > >>> tt.repeat("a-b", "from decimal import Decimal as D; a = D('1.0'); > b = D('0.9999999999')") > [0.14685526219517442, 0.12909696344064514, 0.12646059371189722] > > A factor of 3, as S. Krah, the cdecimal author, claimed I concede the point. But I was "sincere" in my doubt. What I'm curious about now is 1) how much the various operators vary in that 3:1 ratio and 2) how much the overhead portions are using of that time. I have to assume that timeit.repeat doesn't count the time spent in its second argument, right? Because converting a string to a Decimal should be much faster than converting one to float. But what about the overhead of eval(), or whatever it uses? Is the "a-b" converted to byte code just once? Or is it recompiled each time through tje loop? I have to admit not spending much time in timeit(); I usually end up timing things with my own loops. So i'd really like to understand how overhead is figured. -- DaveA