Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'case.': 0.05; 'though:': 0.07; 'python': 0.09; 'complaining': 0.09; 'lawrence': 0.09; 'statistical': 0.09; 'subject:string': 0.09; 'sure,': 0.09; 'windows,': 0.09; 'aug': 0.13; 'cases': 0.15; '"while': 0.16; '10000000': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'justified': 0.16; 'stuff.': 0.16; 'subject:3.3': 0.16; 'true:': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'found,': 0.17; 'windows': 0.19; 'received:209.85.214.174': 0.21; '3.2': 0.22; 'noted': 0.22; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'am,': 0.27; 'then.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'this.': 0.29; "i'm": 0.29; 'maybe': 0.29; 'running': 0.32; 'problem': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'test': 0.36; 'possible': 0.37; 'bad': 0.37; 'two': 0.37; 'subject:New': 0.37; 'quite': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'email addr:gmail.com': 0.63; '20,': 0.65; 'else.': 0.65; 'day': 0.73; '"too': 0.84; 'difference.': 0.84; "it'd": 0.84; 'running,': 0.84; 'story.': 0.93 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:to :content-type; bh=c9mmLgANftHkzGfTfzCkd+klOrHqtOrV5IxFqaifTJ8=; b=dbzg0/hN0WUADibYPRt1EPQCo9fVoJroRPY+AFKxUsmt3s4OJsgEFj5rTvVQqV25qw 7RZV5GHdhyDMcVHJFK5IaiABbsc3FlVljzs0q3EuUc4EwPCLze1mYF5wZWZtU7mWIeOn xiDEzK+DNDbcAiLGxABKwf88FMQczidtMy+s26mAfGQhE5/r1ATOa+CS1z9LZexSlder 5hbeOa3uB1M3yPLAe7aVO2Y1cfiu6dFdjy08hqSVt5qskhAMrwxO8n7ONAO8GcNPtn4C xOiwXgNHlm/5N9kCjih+Np7syBu0CWtXuyrLgmeZCXx8nwDwvuns6QeyljJEGjag1IK1 TZrg== MIME-Version: 1.0 In-Reply-To: References: <5030891f$0$29978$c3e8da3$5496439d@news.astraweb.com> <5030aa44$0$29978$c3e8da3$5496439d@news.astraweb.com> <11931ec9-1858-4ae8-8a61-1d154d105229@googlegroups.com> <73c85f3b-a4a9-4812-bc41-132b5126874c@googlegroups.com> <1f22cebc-71aa-4881-bac5-d97d72fe2633@googlegroups.com> <5570714c-59e7-4149-b2bd-89d7628774e3@googlegroups.com> Date: Mon, 20 Aug 2012 07:50:49 +1000 Subject: Re: New internal string format in 3.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.12 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345413053 news.xs4all.nl 6962 [2001:888:2000:d::a6]:55029 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27435 On Mon, Aug 20, 2012 at 4:09 AM, Mark Lawrence wrote: > On 19/08/2012 18:51, wxjmfauth@gmail.com wrote: >> >> Just for the story. >> >> Five minutes after a closed my interactive interpreters windows, >> the day I tested this stuff. I though: >> "Too bad I did not noted the extremely bad cases I found, I'm pretty >> sure, this problem will arrive on the table". > > How convenient. Not really. Even if he HAD copied-and-pasted those worst-cases, it'd prove nothing. Maybe his system just chose to glitch right then. It's always possible to find statistical outliers that take way way longer than everything else. Watch this. Python 3.2 on Windows is optimized for adding 1 to numbers. C:\Documents and Settings\M>\python32\python -m timeit -r 1 "a=1+1" 10000000 loops, best of 1: 0.0654 usec per loop C:\Documents and Settings\M>\python32\python -m timeit -r 1 "a=1+1" 10000000 loops, best of 1: 0.0654 usec per loop C:\Documents and Settings\M>\python32\python -m timeit -r 1 "a=1+1" 10000000 loops, best of 1: 0.0654 usec per loop C:\Documents and Settings\M>\python32\python -m timeit -r 1 "a=1+2" 10000000 loops, best of 1: 0.0711 usec per loop Now, as long as I don't tell you that during the last test I had quite a few other processes running, including VLC playing a movie and two Python processes running "while True: pass", this will look like a significant performance difference. So now, I'm justified in complaining about how suboptimal Python is when adding 2 to a number, which I can assure you is a VERY common case. ChrisA