Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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: OK 0.063 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'counting': 0.09; 'difference,': 0.09; 'imply': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; 'boundary.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'seems': 0.21; 'machine': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'bigger': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'getting': 0.31; 'with,': 0.31; 'subject:the': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'performance': 0.37; 'starting': 0.37; 'pm,': 0.38; 'sure': 0.39; 'dave': 0.60; 'up,': 0.60; 'numbers': 0.61; "you're": 0.61; 'more': 0.64; 'size.': 0.65; 'results': 0.69; '2015': 0.84; 'guessed': 0.84; 'multiplying': 0.84; 'angel': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=whiYu67sdHYV98b0i6wIy804lmEmTocx6RoZocza2C4=; b=nlj0kIkvqfzBMn5Kf1g1u2QFes5xfiQJFbuIBysn+BLDO/ieNcUGdT1LEfO+p6lvpU c9bbdYkduc9/tH5e4rmKd+EvhfF/n+l4eJ0CYl2dF/flC/dv7eXLzxUBXFla+WOIwySS P5iQHzzSCoFbDC9N0cs/1nySS+tRVDpVu4sK0MEKEA3ZCmJBjBoINFlddfZ2+wz9sRFz 7xvcLsp0bIIhZ+SUtda5W3DzP7Usuy7POhC/iytZVUxAhFYgisJ495MyuM4SnodZUq91 CfUmfgNek5835tLuq7KoIfQ7Gj4MpeqIA3dE5akVPXeDFujozYQwxiVnrAVDOyS8nHUk 2dew== MIME-Version: 1.0 X-Received: by 10.107.160.202 with SMTP id j193mr40458047ioe.43.1430920556804; Wed, 06 May 2015 06:55:56 -0700 (PDT) In-Reply-To: <554A1325.2060103@davea.name> References: <87h9rvm576.fsf@Equus.decebal.nl> <55499304$0$12978$c3e8da3$5496439d@news.astraweb.com> <5549b41f$0$12927$c3e8da3$5496439d@news.astraweb.com> <554A1325.2060103@davea.name> Date: Wed, 6 May 2015 23:55:56 +1000 Subject: Re: Throw the cat among the pigeons From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430920559 news.xs4all.nl 2926 [2001:888:2000:d::a6]:60506 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90057 On Wed, May 6, 2015 at 11:12 PM, Dave Angel wrote: > 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. Are you using Python 2 or Python 3 for your testing? In Py3, there's no type difference, and barely no performance difference as you cross the word-size boundary. (Bigger numbers are a bit slower to work with, but not hugely.) ChrisA