This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: on the speed of std::string::find
Am Montag, den 04.09.2006, 11:22 +0200 schrieb Paolo Carlini:
> Paolo Carlini wrote:
>
> > ... - The old string::find; 2- The current string::find; 3- The
> > version forwarding to memmem; + double check that 1- added of the
> > first char optimization becomes equivalent to 3-.
>
> Denis, can you try on your real data the below, which changes find to
> simply become similar to glibc' memmem? Here, in some basic tests it
> does rather well, better than going through std::search... humm...
>
Hi, I did some simple benchmarks with the different implementation.
yours is the "new find patch" implementation, which seems to be a bit
faster at start, but scales worse. I didn't had enough time today, but I
think within the next few days I can build up a few charts with
descriptions of what I exactly did etc. pp.
http://www.projectiwear.org/~plasmahh/string_bench_simple.png
For my benchmarks I had to convert your function into a freestanding
one, I hope that it didn't make any difference. It would be nice if you
could provide functions to test with also as freestanding functions, as
thats much easier than having to change the systems headers. Also they
are used for actual developement, so I would rather like not to
introduce any accidental bugs there.
greets
Dennis