On 08/19/2012 01:03 PM, Blind Anagram wrote: > "Steven D'Aprano" wrote in message > news:502f8a2a$0$29978$c3e8da3$54964...@news.astraweb.com... > > On Sat, 18 Aug 2012 01:09:26 -0700, wxjmfauth wrote: > > [...] > If you can consistently replicate a 100% to 1000% slowdown in string > handling, please report it as a performance bug: > > http://bugs.python.org/ > > Don't forget to report your operating system. > > ==================================================== > For interest, I ran your code snippets on my laptop (Intel core-i7 > 1.8GHz) running Windows 7 x64. > > Running Python from a Windows command prompt, I got the following on > Python 3.2.3 and 3.3 beta 2: > > python33\python" -m timeit "('abc' * 1000).replace('c', 'de')" > 10000 loops, best of 3: 39.3 usec per loop > python33\python" -m timeit "('ab…' * 1000).replace('…', '……')" > 10000 loops, best of 3: 51.8 usec per loop > python33\python" -m timeit "('ab…' * 1000).replace('…', 'x…')" > 10000 loops, best of 3: 52 usec per loop > python33\python" -m timeit "('ab…' * 1000).replace('…', 'œ…')" > 10000 loops, best of 3: 50.3 usec per loop > python33\python" -m timeit "('ab…' * 1000).replace('…', '€…')" > 10000 loops, best of 3: 51.6 usec per loop > python33\python" -m timeit "('XYZ' * 1000).replace('X', 'éç')" > 10000 loops, best of 3: 38.3 usec per loop > python33\python" -m timeit "('XYZ' * 1000).replace('Y', 'p?')" > 10000 loops, best of 3: 50.3 usec per loop > > python32\python" -m timeit "('abc' * 1000).replace('c', 'de')" > 10000 loops, best of 3: 24.5 usec per loop > python32\python" -m timeit "('ab…' * 1000).replace('…', '……')" > 10000 loops, best of 3: 24.7 usec per loop > python32\python" -m timeit "('ab…' * 1000).replace('…', 'x…')" > 10000 loops, best of 3: 24.8 usec per loop > python32\python" -m timeit "('ab…' * 1000).replace('…', 'œ…')" > 10000 loops, best of 3: 24 usec per loop > python32\python" -m timeit "('ab…' * 1000).replace('…', '€…')" > 10000 loops, best of 3: 24.1 usec per loop > python32\python" -m timeit "('XYZ' * 1000).replace('X', 'éç')" > 10000 loops, best of 3: 24.4 usec per loop > python32\python" -m timeit "('XYZ' * 1000).replace('Y', 'p?')" > 10000 loops, best of 3: 24.3 usec per loop > > This is an average slowdown by a factor of close to 2.3 on 3.3 when > compared with 3.2. >
Using your measurement numbers, I get an average of 1.95, not 2.3 -- DaveA -- http://mail.python.org/mailman/listinfo/python-list