avoid repeated checks with same result on fast lookup path
Change the compareByString() function to a template with a bool
parameter that will disable all the checks, allowing the compiler
to effectively generate just a small inline function. And then
compute the bool value once and call the fast version if true.
With comment #2 in tdf#136838 this actually saves 40% of time.
Change-Id: I5a5190f19a1df163b28e527090ec880e6de5bbda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125768
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>