Re: String search vs regexp search
From: Jeremy Fincher (tweedgeezer_at_hotmail.com)
Date: 10/14/03
- Next message: Peter Seibel: "Re: BIG successes of Lisp (was ...)"
- Previous message: Jeremy Fincher: "Re: question: usage of __slots__"
- In reply to: Duncan Booth: "Re: String search vs regexp search"
- Next in thread: Duncan Booth: "Re: String search vs regexp search"
- Reply: Duncan Booth: "Re: String search vs regexp search"
- Reply: Anand Pillai: "Re: String search vs regexp search"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 13 Oct 2003 21:19:12 -0700
Duncan Booth <duncan@NOSPAMrcp.co.uk> wrote in message news:<Xns941360C9B9445duncanrcpcouk@127.0.0.1>...
> The regular expression code has a startup penalty since it has to compile
> the regular expression at least once, however the actual searching may be
> faster than the naive str.find. If the time spent doing the search is
> sufficiently long compared with the time doing the compile, the regular
> expression may win out.
Both regular expression searching and string.find will do searching
one character at a time; given that, it seems impossible to me that
the hand-coded-in-C "naive" string.find could be slower than the
machine-translated-coded-in-Python regular expression search.
Compilation time only serves to further increase string.find's
advantage.
Jeremy
- Next message: Peter Seibel: "Re: BIG successes of Lisp (was ...)"
- Previous message: Jeremy Fincher: "Re: question: usage of __slots__"
- In reply to: Duncan Booth: "Re: String search vs regexp search"
- Next in thread: Duncan Booth: "Re: String search vs regexp search"
- Reply: Duncan Booth: "Re: String search vs regexp search"
- Reply: Anand Pillai: "Re: String search vs regexp search"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|