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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'sufficient': 0.05; 'ascii': 0.07; 'builtin': 0.07; 'dev': 0.07; 'happen,': 0.07; 'indexing': 0.07; 'remaining': 0.07; 'python': 0.09; '(it': 0.09; 'does,': 0.09; 'pep': 0.09; 'raised.': 0.09; 'regression': 0.09; 'speakers,': 0.09; 'language,': 0.11; 'subject:python': 0.11; '(the': 0.15; 'cases': 0.15; '3.2,': 0.16; '3.2.': 0.16; 'ascii,': 0.16; 'build.': 0.16; 'correctness.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "isn't.": 0.16; 'non- english': 0.16; 'operation.': 0.16; 'overwriting': 0.16; 'python;': 0.16; 'slicing,': 0.16; 'subject:3.3': 0.16; 'subject:String': 0.16; 'thread.': 0.16; 'utterly': 0.16; 'worst': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'instance,': 0.17; 'string,': 0.17; 'unicode': 0.17; 'equivalent': 0.20; 'assumes': 0.22; 'constant': 0.22; 'operations.': 0.22; 'trace': 0.22; "i'd": 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'rest': 0.28; 'cases.': 0.29; 'factor': 0.29; 'overhead': 0.29; 'character': 0.29; 'that.': 0.30; 'function': 0.30; 'code': 0.31; 'builds': 0.33; 'skip:j 20': 0.33; 'to:addr:python-list': 0.33; 'everyone': 0.33; 'another': 0.33; 'version': 0.34; 'received:google.com': 0.34; 'done': 0.34; 'compared': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'similar': 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; 'two': 0.37; 'being': 0.37; 'quite': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'performance': 0.39; 'to:addr:python.org': 0.39; 'build': 0.39; 'skip:u 10': 0.60; 'wide': 0.62; 'is.': 0.62; 'more': 0.63; 'show': 0.63; 'replying': 0.64; 'making': 0.64; 'taking': 0.65; 'compliant': 0.65; 'readers': 0.65; 'unnecessary': 0.65; 'subject': 0.66; 'hours': 0.66; 'believe': 0.69; 'benefit': 0.70; 'brand': 0.78; 'tags,': 0.81; '2013': 0.84; 'complaint': 0.84; 'compliance,': 0.84; 'non-us': 0.84; 'penalty': 0.84; 'permit,': 0.84; 'pike': 0.84; 'rusi': 0.91; 'serious': 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=INT4NIXuH0rff1mfqUhBFgmCsv4kPbjJjg2f2AiSkhs=; b=ua45ykmVSM5L3gJDdHBRCnqmp06Tm0wMqBh0uTZtWIM+cHkSsBO5zq/UT9ze1EbJpm sGWEQAJg6HGfxWaqo04mOQheOsyrj6889SO1GowdKEzuDukJNMoeesGAPdtOr5630nhE wQDzQlRWvIa5EL3KTwyWs/wKv6KwgNgL+5lNvniykMMQpmxdKrba9UmlcBx3qm3EicQW yOySxik+nUoIX2qZYQQqjFVOV6wdkzuUTjvZoXFK0kBU0CTFBI8Ba1vU6VZiqA57J3Au fP6wh8nwespMOxUdF3VwP/DKSVtw63cJTe+iiVlgJ9Rgl86+a4KWOYl9itLR6uJLWCJb G0Aw== MIME-Version: 1.0 X-Received: by 10.58.50.7 with SMTP id y7mr8224590ven.24.1363172348474; Wed, 13 Mar 2013 03:59:08 -0700 (PDT) In-Reply-To: References: <23a42297-9262-4ace-87ad-138999b1ddd6@z3g2000vbg.googlegroups.com> Date: Wed, 13 Mar 2013 21:59:08 +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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363172350 news.xs4all.nl 6964 [2001:888:2000:d::a6]:37971 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41170 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. The PEP 393 string is simply a memory-optimized version of UTF-32. It guarantees O(1) indexing and slicing, while still remaining tight in many cases. Its worst case is a constant amount larger than pure UTF-32 (the overhead of recording the string width), its best case is equivalent to ASCII (if all strings are seven-bit). The flexible string representation is not brand new. It has been tested and proven in another language, one very similar to Python; and its performance has been provably sufficient for everyday operations. Pike's string type behaves just as Python 3.3's, and has done for longer than I can trace backward. In terms of Unicode compliance, it is perfect; in terms of performance, quite acceptable; the worst-case operation is taking an ASCII string and overwriting one character in it with an astral character - which Python flat-out doesn't permit, but Pike does, as a known-slow operation. (It triggers a copy of the string, so it's always going to be slow.) There are two broad areas of complaint that you have raised. One is of Unicode compliance and correctness. I believe those complaints are utterly unfounded, and you have yet to show any serious evidence to support them. Py 3.3 is perfectly compliant with everything I have yet checked. The other complaint is of performance, and the issue of being US-centric. While it's true that ASCII and Latin-1 strings will be smaller/faster under Py 3.3 than 3.2, this is not purely to the benefit of the US at the cost of everyone else; it's also a benefit to the myriad non-US programs that use a lot of ASCII strings - for instance, delimiters, HTML tags, builtin function names... all of these are ASCII, even if the rest of the code isn't. And there's no penalty for non-English speakers, when compared against a non-buggy wide build. The very worst case is only a constant factor worse, and that assumes astral characters in every single string... which does not happen, trust me on that. ChrisA