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 Dienstag, den 05.09.2006, 10:42 +0200 schrieb Paolo Carlini:
> Dennis Lubert wrote:
>
> >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
> >
> >
> Dennis, thanks for your help, but something is certainly wrong in the
> benchmarking, we can't trust it. Likely, it's because of the
> optimization level, or something else. As I said already, you must use
> -O2, otherwise we are measuring something which nobody will see in
> practice.
Sorry, you are right of course. I shouldn't do such tests at 3am.
http://www.projectiwear.org/~plasmahh/string_bench_new.png
These are the new results, and indeed the new implementation has nearly
identical performance to memmem. The tests denote the speed (yaxis)
against the position within a string to search for. The length of the
string to be searched for is fixed to 10. I will do some tests on how
the new implementation scales against longer strings to be searched for,
but I am very confident that it also scales better here, leading to a
much better overall performance for all cases.
greets
Dennis