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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'mrab': 0.05; 'dev': 0.07; 'python': 0.09; '16-bit': 0.09; 'exception,': 0.09; 'regression': 0.09; 'sure,': 0.09; 'thrown': 0.09; 'unexpectedly': 0.09; "wouldn't": 0.11; 'subject:python': 0.11; 'cases': 0.15; '3.2.': 0.16; 'buggy': 0.16; 'efficiency.': 0.16; 'encountered,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'graceful': 0.16; 'incomplete': 0.16; 'pairs': 0.16; 'statement.': 0.16; 'subject:3.3': 0.16; 'subject:String': 0.16; 'thread.': 0.16; 'utterly': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'bytes': 0.17; 'string,': 0.17; 'thu,': 0.17; 'unicode': 0.17; 'version.': 0.17; '>>>': 0.18; 'trying': 0.21; '3.2': 0.22; 'assumes': 0.22; "i'd": 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'chris': 0.28; '>>>>': 0.29; 'factor': 0.29; 'character': 0.29; 'that.': 0.30; 'sense': 0.31; 'code': 0.31; 'support,': 0.32; 'switch': 0.32; 'builds': 0.33; 'skip:j 20': 0.33; 'to:addr:python-list': 0.33; 'point.': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'compared': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'characters': 0.36; 'useful': 0.36; 'should': 0.36; 'does': 0.37; 'being': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'instead': 0.39; 'performance': 0.39; 'to:addr:python.org': 0.39; 'build': 0.39; 'space': 0.39; 'think': 0.40; 'skip:u 10': 0.60; 'wide': 0.62; 'is.': 0.62; 'between': 0.63; 'more': 0.63; 'replying': 0.64; 'making': 0.64; 'readers': 0.65; 'theoretical': 0.65; 'unnecessary': 0.65; 'subject': 0.66; 'hours': 0.66; 'talking': 0.66; 'believe': 0.69; '2013': 0.84; 'choices:': 0.84; 'fourth': 0.84; 'inefficient': 0.91; 'rusi': 0.91 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=GQzLAq1qhXYPSO1i2sXIK6DdhwcvfKmtZuW1Xbe22bI=; b=neQJrEceSAtVyKt/Wjru1K75UiuBL0QEg2MtRtuawLQwhGRNOYLy/p2QMpEzhO09+n VloOT1sSnoVcPd0TtDPNh+QjSh3Ctqgi5NR7uzdYYQXSlZ6gOrFGi4uwYUKeCIyTB/8F IZB1bNcPXuhlvoLyQtdxwKZbDxpubkY+9bgz9BA5IMWP/hkIOzWGx9DoNRKX1eyyDHQH Z7tKPv8EEqFkGAHEU12HIrQ3VGfoD9hDtyLR5hT/ameUkF6V+eY+U5HyK4+iQbio7/ND 9AZOyI/1pWRgInuwW8/lurrhzjD2dwBcMf1afgFT+Xa9s5rTXVlmp70wHgbl6x53BKxZ t2Iw== MIME-Version: 1.0 X-Received: by 10.52.22.194 with SMTP id g2mr161301vdf.91.1363222547651; Wed, 13 Mar 2013 17:55:47 -0700 (PDT) In-Reply-To: <51411F38.1040901@mrabarnett.plus.com> References: <23a42297-9262-4ace-87ad-138999b1ddd6@z3g2000vbg.googlegroups.com> <51411F38.1040901@mrabarnett.plus.com> Date: Thu, 14 Mar 2013 11:55:47 +1100 Subject: Re: String performance regression from python 3.2 to 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.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: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363222550 news.xs4all.nl 6849 [2001:888:2000:d::a6]:54597 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41204 On Thu, Mar 14, 2013 at 11:52 AM, MRAB wrote: > On 13/03/2013 23:43, Chris Angelico wrote: >> >> On Thu, Mar 14, 2013 at 3:49 AM, rusi wrote: >>> >>> On Mar 13, 3:59 pm, Chris Angelico wrote: >>>> >>>> On Wed, Mar 13, 2013 at 9:11 PM, rusi wrote: >>>> > Uhhh.. >>>> > Making the subject line useful for all readers >>>> >>>> I should have read this one before replying in the other thread. >>>> >>>> jmf, I'd like to see evidence that there has been a performance >>>> regression compared against a wide build of Python 3.2. You still have >>>> never answered this fundamental, that the narrow builds of Python are >>>> *BUGGY* in the same way that JavaScript/ECMAScript is. And believe you >>>> me, the utterly unnecessary hassles I have had to deal with when >>>> permitting user-provided .js code to script my engine have wasted >>>> rather more dev hours than you would believe - there are rather a lot >>>> of stupid edge cases to deal with. >>> >>> >>> This assumes that there are only three choices: >>> - narrow build that is buggy (surrogate pairs for astral characters) >>> - wide build that is 4-fold space inefficient for wide variety of >>> common (ASCII) use-cases >>> - flexible string engine that chooses a small tradeoff of space >>> efficiency over time efficiency. >>> >>> There is a fourth choice: narrow build that chooses to be partial over >>> being buggy. ie when an astral character is encountered, an exception >>> is thrown rather than trying to fudge it into a 16-bit >>> representation. >> >> >> As a simple factual matter, narrow builds of Python 3.2 don't do that. >> So it doesn't factor into my original statement. But if you're talking >> about a proposal for 3.4, then sure, that's a theoretical possibility. >> It wouldn't be "buggy" in the sense of "string indexing/slicing >> unexpectedly does the wrong thing", but it would still be incomplete >> Unicode support, and I don't think people would appreciate it. Much >> better to have graceful degradation: if there are non-BMP characters >> in the string, then instead of throwing an exception, it just makes >> the string wider. >> > [snip] > Do you mean that instead of switching between 1/2/4 bytes per codepoint > it would switch between 2/4 bytes per codepoint? That's my point. We already have the better version. :) ChrisA