Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:()': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'terry': 0.09; '(windows': 0.16; 'a",': 0.16; 'guys,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject: \n ': 0.16; 'subject:unicode': 0.16; 'subject:variable': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'tests': 0.18; '>>>': 0.18; 'import': 0.21; '3.2': 0.22; 'example': 0.23; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'replace': 0.27; 'correct': 0.28; 'header:X -Complaints-To:1': 0.28; 'fast.': 0.29; "i'm": 0.29; "skip:' 10": 0.30; 'call.': 0.30; 'sense': 0.31; 'point': 0.31; 'space,': 0.32; 'idle': 0.33; 'to:addr:python-list': 0.33; 'whatever': 0.35; 'said,': 0.35; 'open': 0.35; 'pm,': 0.35; 'similar': 0.35; 'received:org': 0.36; 'compare': 0.36; 'problems': 0.36; 'skip:p 20': 0.36; 'enough': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'high': 0.61; 'time,': 0.62; 'skip:6 10': 0.63; 'times': 0.63; 'email addr:gmail.com': 0.63; 'making': 0.64; 'increase': 0.72; '100': 0.78; 'received:fios.verizon.net': 0.84; 'subject:value': 0.84; 'victor': 0.84; 'ratio': 0.91; 'period.': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: How do I display unicode value stored in a string variable using ord() Date: Sat, 18 Aug 2012 16:09:14 -0400 References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <4c62a649-bc21-4e47-9c0f-acb1b1e70e36@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <4c62a649-bc21-4e47-9c0f-acb1b1e70e36@googlegroups.com> 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345320581 news.xs4all.nl 6951 [2001:888:2000:d::a6]:33364 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27329 On 8/18/2012 12:38 PM, wxjmfauth@gmail.com wrote: > Sorry guys, I'm not stupid (I think). I can open IDLE with > Py 3.2 ou Py 3.3 and compare strings manipulations. Py 3.3 is > always slower. Period. You have not tried enough tests ;-). On my Win7-64 system: from timeit import timeit print(timeit(" 'a'*10000 ")) 3.3.0b2: .5 3.2.3: .8 print(timeit("c in a", "c =3D '=E2=80=A6'; a =3D 'a'*10000")) 3.3: .05 (independent of len(a)!) 3.2: 5.8 100 times slower! Increase len(a) and the ratio can be made as = high as one wants! print(timeit("a.encode()", "a =3D 'a'*1000")) 3.2: 1.5 3.3: .26 Similar with encoding=3D'utf-8' added to call. Jim, please stop the ranting. It does not help improve Python. utf-32 is = not a panacea; it has problems of time, space, and system compatibility=20 (Windows and others). Victor Stinner, whatever he may have once thought=20 and said, put a *lot* of effort into making the new implementation both=20 correct and fast. On your replace example >>> imeit.timeit("('ab=E2=80=A6' * 1000).replace('=E2=80=A6', '=E2=80=A6= =E2=80=A6')") > 61.919225272152346 >>> timeit.timeit("('ab=E2=80=A6' * 10).replace('=E2=80=A6', '=C5=93=E2=80= =A6')") > 1.2918679017971044 I do not see the point of changing both length and replacement. For me,=20 the time is about the same for either replacement. I do see about the=20 same slowdown ratio for 3.3 versus 3.2 I also see it for pure search=20 without replacement. print(timeit("c in a", "c =3D '=E2=80=A6'; a =3D 'a'*1000+c")) # .6 in 3.2.3, 1.2 in 3.3.0 This does not make sense to me and I will ask about it. --=20 Terry Jan Reedy