in reply to Regular expression speed issues

meth1 and meth3 use regular expressions. meth2 uses index(). Finding fixed strings is much easier than finding patterns.

You seem to think meth2 shouldn't be much faster than the other methods. I wonder why.

Abigail

Replies are listed 'Best First'.
Re: Re: Regular expression speed issues
by TimToady (Parson) on Jul 22, 2003 at 16:08 UTC
    But note that the presence of utf-8 can slow down functions such as index() and substr() that rely on offsets. It would be possible to get around that by caching the last known offset in a string, but as far as I know, that optimization hasn't been done yet.
Re: Re: Regular expression speed issues
by dannoura (Pilgrim) on Jul 22, 2003 at 08:02 UTC

    Method1 is the fastest (by far) and it uses a regular expression.