Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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; 'encode': 0.09; 'imply': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'encoding': 0.15; "skip:' 30": 0.15; '3.2.': 0.16; 'amd64': 0.16; 'attempt.': 0.16; 'bigger.': 0.16; 'characters:': 0.16; 'cp1252': 0.16; 'dismiss': 0.16; 'luckily,': 0.16; 'measurement': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'subject:Big': 0.16; 'subject:subject': 0.16; 'wrote:': 0.17; 'examples': 0.18; 'causing': 0.20; 'skip:" 30': 0.20; 'bit': 0.21; 'connected': 0.24; 'linux': 0.24; 'header:User-Agent:1': 0.26; 'coding': 0.27; 'header:X-Complaints-To:1': 0.28; '100000': 0.29; '8bit%:25': 0.29; 'factor': 0.29; 'safely': 0.33; 'to:addr:python- list': 0.33; 'too.': 0.35; 'received:org': 0.36; 'characters': 0.36; 'ok,': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'subject:, ': 0.61; 'first': 0.61; 'chance': 0.61; 'repeat': 0.62; 'email addr:gmail.com': 0.63; '10000': 0.65; '10.3': 0.84; '8bit%:24': 0.84; 'agree?': 0.84; 'replicate': 0.84; 'subject:Abuse': 0.84; '8bit%:18': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Abuse of subject, was Re: Abuse of Big Oh notation Date: Tue, 21 Aug 2012 09:52:09 +0200 Organization: None References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <7xehn4vyya.fsf@ruckus.brouhaha.com> <5030832d$0$29978$c3e8da3$5496439d@news.astraweb.com> <7x8vdbmho6.fsf@ruckus.brouhaha.com> <7xfw7ilqnd.fsf@ruckus.brouhaha.com> <50314968$0$29978$c3e8da3$5496439d@news.astraweb.com> <7xwr0ua1pw.fsf@ruckus.brouhaha.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Gmane-NNTP-Posting-Host: p5084b0c0.dip.t-dialin.net User-Agent: KNode/4.7.3 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: 1345535550 news.xs4all.nl 6983 [2001:888:2000:d::a6]:58607 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27556 wxjmfauth@gmail.com wrote: > By chance and luckily, first attempt. > c:\python32\python -m timeit "('€'*100+'€'*100).replace('€' > , 'œ')" > 1000000 loops, best of 3: 1.48 usec per loop > c:\python33\python -m timeit "('€'*100+'€'*100).replace('€' > , 'œ')" > 100000 loops, best of 3: 7.62 usec per loop OK, that is roughly factor 5. Let's see what I get: $ python3.2 -m timeit '("€"*100+"€"*100).replace("€", "œ")' 100000 loops, best of 3: 1.8 usec per loop $ python3.3 -m timeit '("€"*100+"€"*100).replace("€", "œ")' 10000 loops, best of 3: 9.11 usec per loop That is factor 5, too. So I can replicate your measurement on an AMD64 Linux system with self-built 3.3 versus system 3.2. > Note > The used characters are not members of the latin-1 coding > scheme (btw an *unusable* coding). > They are however charaters in cp1252 and mac-roman. You seem to imply that the slowdown is connected to the inability of latin-1 to encode "œ" and "€" (to take the examples relevant to the above microbench). So let's repeat with latin-1 characters: $ python3.2 -m timeit '("ä"*100+"ä"*100).replace("ä", "ß")' 100000 loops, best of 3: 1.76 usec per loop $ python3.3 -m timeit '("ä"*100+"ä"*100).replace("ä", "ß")' 10000 loops, best of 3: 10.3 usec per loop Hm, the slowdown is even a tad bigger. So we can safely dismiss your theory that an unfortunate choice of the 8 bit encoding is causing it. Do you agree?