On 5/7/2013 9:22 AM, jmfauth road forth on his dead hobbyhorse to hijack yet another thread:

# Py 3.3 ascii and non ascii chars
timeit.repeat("a = 'hundred'; 'x' in a")
[0.11426985953005442, 0.10040049292649655, 0.09920834808588097]
timeit.repeat("a = 'maçãé€ẞ'; 'é' in a")
[0.2345595188256766, 0.21637172864154763, 0.2179096624382737]

Python 3.3 is a language. Languages do not have timings.
CPython 3.3.0 is an implementation compiled and run under a particular OS and hardware. With respect to Unicode timings, especially for find/replace, it is obsolete. On my Win7 machine with fresh debug builds from the current repository, I see these times.

Python 3.3.1+ (default, May  7 2013, 14:03:12) [MSC v.1600 32 bit (Int
>>> from timeit import repeat
>>> repeat("a = 'hundred'; 'x' in a")
[0.19007337649622968, 0.190116721780754, 0.1900149679567562]
>>> repeat("a = 'maçaé??'; 'é' in a")
[0.20568874581187716, 0.20568782357178053, 0.20577051776710914]

Python 3.4.0a0 (default:32067784f198, May  7 2013, 13:59:10) [MSC v.1600
>>> from timeit import repeat
>>> repeat("a = 'hundred'; 'x' in a")
[0.1708080882915779, 0.17062978853956826, 0.1706740560642051]
>>> repeat("a = 'maçaé??'; 'é' in a")
[0.17612111348809734, 0.17562925210324565, 0.17549245315558437]

Note 1: debug builds are slower than install builds, especially for microbenchmarks with trivial statements. My installed 3.3.1 on a different machine has timings of about .1 for the ascii test. It is slower for the non-ascii test because the latest improvements were made after 3.3.1 was released.

Note 2: 3.4 has additional improvements that speed up everything, so that the 3.4 non-ascii time is faster that even the 3.3 ascii time.

Terry


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to