Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!feeder.erje.net!eu.feeder.erje.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.023 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.06; '128': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '4:35': 0.16; 'clear.': 0.16; 'crop': 0.16; 'integers,': 0.16; 'internally': 0.16; 'words.': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'bit': 0.19; 'machine': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; '2.x': 0.24; 'merge': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'words': 0.29; 'needed.': 0.30; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; '3.x': 0.31; 'breaking': 0.31; 'received:google.com': 0.35; 'words,': 0.36; 'performance': 0.37; 'problems': 0.38; 'pm,': 0.38; 'heard': 0.39; 'either': 0.39; 'removing': 0.60; 'worry': 0.60; 'new': 0.61; 'to:addr:gmail.com': 0.65; 'effectively': 0.66; 'mar': 0.68; 'computers': 0.72; "int's,": 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:cc:content-type; bh=Gtm+oQxEYr2Zkh9c2To9/XG167KgzwFhFn+roHlQokA=; b=WGoelTp858HOciuLj2/BSp8BVRV2KuIPpLbfkf+Dtokvma/GnJbfAYClu5VLq3QI/N hhjtYMh8sAHruvmp6UPoSu1M63HoPzvW6klYQaDtlFfLpaiGpfug0/fWmoFnxi6CvD19 MtRnTi5IH5XJJltzcdqSEWdJNzsQOkbrMF6Mi7wV+olD79jGerkhBTtJhVEEK+MD+q4U NNjD5efHdixD1F8Y6RTQH8q0l2oJw7tzrWTPMr2Cw8jTlDgsL2ikLeM9MKpGNQ5BgHXT PXeN4lU5Gzc4yFO5rIwvPmbEalFCUo4nZJ3b24OlG/4oLRzj/+5h5Jv6pg07PmD5dFrU 3qcQ== MIME-Version: 1.0 X-Received: by 10.229.123.10 with SMTP id n10mr85273qcr.89.1364256730569; Mon, 25 Mar 2013 17:12:10 -0700 (PDT) In-Reply-To: References: Date: Mon, 25 Mar 2013 17:12:10 -0700 Subject: Re: Performance of int/long in Python 3 From: Dan Stromberg To: Cousin Stanley Content-Type: multipart/alternative; boundary=0015175734a6cef7d604d8c8c5da Cc: python-list@python.org 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364256738 news.xs4all.nl 6927 [2001:888:2000:d::a6]:38982 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41839 --0015175734a6cef7d604d8c8c5da Content-Type: text/plain; charset=ISO-8859-1 On Mon, Mar 25, 2013 at 4:35 PM, 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. > > .... > I thought I heard that Python 3.x will use machine words for small integers, and automatically coerce internally to a 2.x long as needed. Either way, it's better to have a small performance cost to avoid problems when computers move from 32 to 64 bit words, or 64 bit to 128 bit words. With 3.x int's, you don't have to worry about a new crop of CPU's breaking your code. --0015175734a6cef7d604d8c8c5da Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On Mon, Mar 25, 2013 at 4:35 = PM, Cousin Stanley <cousinstanley@gmail.com> 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.
> ....
=A0
I thought I heard that Python = 3.x will use machine words for small integers, and automatically coerce int= ernally to a 2.x long as needed.

Either way, it= 9;s better to have a small performance cost to avoid problems when computer= s move from 32 to 64 bit words, or 64 bit to 128 bit words. =A0With 3.x int= 's, you don't have to worry about a new crop of CPU's breaking = your code.

--0015175734a6cef7d604d8c8c5da--