on the speed of std::string::find

Paolo Carlini pcarlini@suse.de
Sun Sep 3 20:42:00 GMT 2006


Jari Sundell wrote:

> After reading the man page, especially its reference to needles and
> haystacks, I was expecting it to use an algorithm similar to
> Boyer-Moore. Is there's any specifc reasons for it not doing this?

I seem to remember that some of these issues have been discussed already 
when a new implementation of search_n has been contributed... Certainly 
there are many factors to consider, whether tables are wanted or not, 
startup costs... Honestly, I'm not sure we want to start from scratch 
with string matching: there are entire PhDs devoted to it ;) I would 
suggest first clearing a bit what we have, what we had, how we are 
really doing on many different cases, always taking into account the 
effect of the optimizers (the compiler is quickly evolving in its 
treatment of the string functions/builtins).

Paolo.



More information about the Libstdc++ mailing list