[Python-Dev] partition() (was: Remove str.find in 3.0?)

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Wed Aug 31 10:16:59 CEST 2005


Josiah Carlson a écrit :
> Pierre Barbier de Reuille <pierre.barbier at cirad.fr> wrote:
> 
> 0.5
> 
> So, subtracting that .5 seconds from all the cases gives us...
> 
> 0.343 seconds for .find's comparison
> 0.313 seconds for .index's exception handling when an exception is not
> raised
> 3.797 seconds for .index's exception handling when an exception is
> raised.

Well, when I did benchmark that (two years ago) the difference was,
AFAIR, much greater ! But well, I just have to adjust my internal data
sets ;)

Pierre

> 
> In the case of a string being found, .index is about 10% faster than
> .find .  In the case of a string not being found, .index's exception
> handlnig mechanics are over 11 times slower than .find's comparison.
> 
> [...]
> 
>  - Josiah
> 

-- 
Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68


More information about the Python-Dev mailing list