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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'differently': 0.07; 'versions,': 0.07; 'consistency': 0.09; 'optimizing': 0.09; 'python': 0.11; 'mostly': 0.14; '2.7.3': 0.16; 'aiming': 0.16; 'behave': 0.16; 'clear.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'somewhere.': 0.16; 'wrote:': 0.18; 'python?': 0.22; 'merge': 0.24; 'visible': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '3.x': 0.31; 'quite': 0.32; 'running': 0.33; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'received:209': 0.37; 'clear': 0.37; 'same.': 0.38; 'to:addr:python-list': 0.38; 'though,': 0.39; 'to:addr:python.org': 0.39; 'removing': 0.60; "you're": 0.61; 'effectively': 0.66; 'here': 0.66; 'mar': 0.68; '26,': 0.68; 'inline': 0.74; 'subject:long': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=sq2EcC4wW8PnEIhKkPcQ8K6rFUYG57basQt/HyTNoM8=; b=eRmx2DiLM3kvre/eHTjPTdwG0sYCrsASruwKatpnK8079mMy8CqXGG4u6aqK3v58pV oZlg48IPclSx1phgHn2Ij3sLtKkeeLIBZcM7e8puJTX/0Gl9aO8J+gqX1IbsYwv+XZtB Q1YzqfA8Ep3TQ/9ce0EU7UdlMZIJzw2+2vf9n9/uUB+PQiOZDSfUGFzqOmUuNo3ITSTV yz+SCJYD4zWmPWD6w7NkbaFIScT14s2yqeSMVXiDQy0dxXfNwzw9xguOtsGcsNEGvrZ/ 79TNWWSKsOCsAf6Makae5TP/gP+GyBQxQykMksKzqzmzdsAgqSs/Jh0qd5pYAJbcTksE PgUA== MIME-Version: 1.0 X-Received: by 10.220.231.199 with SMTP id jr7mr18558909vcb.70.1364279191483; Mon, 25 Mar 2013 23:26:31 -0700 (PDT) In-Reply-To: References: Date: Tue, 26 Mar 2013 17:26:31 +1100 Subject: Re: Performance of int/long in Python 3 From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364279193 news.xs4all.nl 6845 [2001:888:2000:d::a6]:36972 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41857 On Tue, Mar 26, 2013 at 10:35 AM, Cousin Stanley wrote: > > Chris Angelico wrote: > >> The Python 3 merge of int and long has effectively penalized >> small-number arithmetic by removing an optimization. >> .... >> The cost is clear. >> .... > > The cost isn't quite as clear > under Debian Wheezy here .... > > Stanley C. Kitching > Debian Wheezy > > python inline range_sum forloop forloop_offset > > 2.7.3 3.1359 3.0725 9.0778 15.6475 > > 3.2.3 2.8226 2.8074 13.47624 13.6430 Interesting, so your 3.x sum() is optimizing something somewhere. Strange. Are we both running the same Python? I got those from apt-get, aiming for consistency (rather than building a 3.3 from source). The cost is still visible in the for-loop versions, though, and you're still seeing the <2^31 and >2^31 for-loops behave the same way in 3.x but perform quite differently in 2.x. So it's looking like things are mostly the same. ChrisA