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
Paolo Carlini wrote:
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.
Just to say one, without inlining at -O0, going through type_traits (the
tiny eq, in particular) means function calls which are certainly heavy
to do for each char. This thing alone makes the "new" implementation
appear much slower than memmem where the algorithm is in fact the same.
Paolo.