trying to strip out non ascii.. or rather convert non ascii

Tim Chase python.list at tim.thechases.com
Tue Oct 29 11:52:49 EDT 2013


On 2013-10-29 08:38, wxjmfauth at gmail.com wrote:
> >>> import timeit
> >>> timeit.timeit("a = 'hundred'; 'x' in a")  
> 0.12621293837694095
> >>> timeit.timeit("a = 'hundreij'; 'x' in a")  
> 0.26411553466961735

That reads to me as "If things were purely UCS4 internally, Python
would normally take 0.264... seconds to execute this test, but core
devs managed to optimize a particular (lower 127 ASCII characters
only) case so that it runs in less than half the time."

Is this not what you intended to demonstrate?  'cuz that sounds
like a pretty awesome optimization to me.

-tkc






More information about the Python-list mailing list