Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: UNSURE 0.217 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.57; '*S*': 0.00; 'counting': 0.09; 'difference,': 0.09; 'imply': 0.09; 'testing,': 0.09; "wouldn't": 0.14; 'implemented,': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'machine': 0.22; 'memory': 0.22; 'header:User-Agent:1': 0.23; 'wednesday': 0.24; 'compare': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'instruction': 0.29; 'bigger': 0.30; "i'm": 0.30; 'getting': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'though.': 0.31; 'guess': 0.33; 'subject:the': 0.34; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'add': 0.35; 'should': 0.36; 'starting': 0.37; 'to:addr:python-list': 0.38; 'that,': 0.38; 'expensive': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'system.': 0.39; 'how': 0.40; 'days': 0.60; 'up,': 0.60; 'simply': 0.61; "you're": 0.61; 'more': 0.64; 'management': 0.65; 'size.': 0.65; 'charset:windows-1252': 0.65; 'frequently': 0.68; 'received:74.208': 0.68; 'results': 0.69; '10%': 0.74; '2015': 0.84; 'guessed': 0.84; 'multiplying': 0.84; 'noise': 0.84; 'predicted,': 0.84; 'upwards': 0.84 Date: Wed, 06 May 2015 09:12:05 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Throw the cat among the pigeons References: <87h9rvm576.fsf@Equus.decebal.nl> <55499304$0$12978$c3e8da3$5496439d@news.astraweb.com> <5549b41f$0$12927$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <5549b41f$0$12927$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:wsj0qkAxphz1982D2i+x7GuxnZXRVV1tEcNex6x4J+GVelcaPYq rCYpXSpgpkOFYoWTbNgXSk9dQDoJ1qa5gXL8c90YWlyGSWePxHJPVCeHMjycBXORNJ6qzri p86MdjtS33N6xR0h6I5dmlxqh9OXqdobagVlAF6CCTVIbITeaD9hkHTopnse11MqFi70OKc znz1npqUl/ahy84EwVqhQ== X-UI-Out-Filterresults: notjunk:1; X-Mailman-Approved-At: Wed, 06 May 2015 15:40:52 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430919653 news.xs4all.nl 2837 [2001:888:2000:d::a6]:56478 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90056 On 05/06/2015 02:26 AM, Steven D'Aprano wrote: > On Wednesday 06 May 2015 14:05, Steven D'Aprano wrote: > My interpretation of this is that the difference has something to do with > the cost of multiplications. Multiplying upwards seems to be more expensive > than multiplying downwards, a result I never would have predicted, but > that's what I'm seeing. I can only guess that it has something to do with > the way multiplication is implemented, or perhaps the memory management > involved, or something. Who the hell knows? > I had guessed that the order of multiplication would make a big difference, once the product started getting bigger than the machine word size. Reason I thought that is that if you multiply starting at the top value (and end with multiplying by 2) you're spending more of the time multiplying big-ints. That's why I made sure that both Cecil's and my implementations were counting up, so that wouldn't be a distinction. I'm still puzzled, as it seems your results imply that big-int*int is faster than int*int where the product is also int. That could use some more testing, though. I still say a cutoff of about 10% is where we should draw the line in an interpretive system. Below that, you're frequently measuring noise and coincidence. Remember the days when you knew how many cycles each assembly instruction took, and could simply add them up to compare algorithms? -- DaveA