Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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: OK 0.060 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.01; 'subject:Python': 0.06; 'correct.': 0.07; 'integers': 0.09; 'python': 0.11; '2.6.4': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'slight': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'long,': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done,': 0.36; 'ubuntu': 0.36; 'done': 0.36; 'received:209': 0.37; 'massive': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'times': 0.62; 'series': 0.66; 'mar': 0.68; 'improvements': 0.68; 'inline': 0.74; 'improvement': 0.84; '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=6DBfD/mCVShIW8NOtSH7RARPAyRh7t9ZtPG44xiM0PE=; b=EGumpnn1t2EVKatD5a3RFrs8zLhk4nxUAXem8SIlGGIsJeBsXyks+2BwXLg/UFIrlx E4w8+c6dHq7Iabcd+Hfn8jeKqYyDsAeyD70Ui+/qQuTjYGih/w3cbyr8OlpWedx5KCrR KuHqK/MbahOF/0eQu1adLfF4rG/r0dGnY7IQQl2j85XvSwhtUtB4CGt60lzrdqYwLZT4 f0f5ylp9HsMjC7duyZ96jLM03vOOFm8qLdC24VIIuBKelBjKp6Pf4gdvIMFQxwMRL5vl 62+VkcOMSNHrlIlrxe+EB9YTZ8yH6Co59mlfpJvUL+QqTwvDA3fDUhQqMt1Fl8bQSg4E sJyg== MIME-Version: 1.0 X-Received: by 10.52.111.130 with SMTP id ii2mr5888363vdb.111.1364316887639; Tue, 26 Mar 2013 09:54:47 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Mar 2013 03:54:47 +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: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364316890 news.xs4all.nl 6906 [2001:888:2000:d::a6]:43926 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41923 On Wed, Mar 27, 2013 at 3:41 AM, Cousin Stanley wrote: > > Chris Angelico wrote: > >> Once again, Py3 is slower on small integers than Py2. > > Chris Angelico > Ubuntu Karmic. > Pentium(R) Dual-Core CPU E6500 @ 2.93GHz. > > python inline range_sum forloop forloop_offset > > 2.6.4 2.7050 2.6492 6.5877 16.5168 > > 3.1.1 4.4453 4.3731 12.4834 13.5001 > > You do seem to have a slight py3 improvement > under ubuntu for the forloop_offset case .... Yes, that's correct. The forloop_offset one is using long integers in all cases. (Well, on Py2 it's adding a series of ints to a long, but the arithmetic always has to be done with longs.) Python 3 has had some improvements done, but the main thing is that there's a massive spike in the Py2 time, while Py3 has _already paid_ that cost - as evidenced by the closeness of the forloop and forloop_offset times on Py3. ChrisA