Other things that might gain some speed:
Unwrap the pthread wrapper to shave some time spent in critical
For that matter, unwrap frequently used small wrappers like ber_memalloc.
A Makefile target which builds with gcc -fprofile-generate, runs some
tests, then does make clean and rebuilds with -fprofile-use. Except
it didn't work for me, ld complained about __gcov_merge_add. Oh well.
Use the C99 'restrict' keyword when available, e.g. on struct berval*
parameters. Functions that e.g. receive a struct berval*, uses it
frequently, and modifies bv->bv_val[...], cannot be optimized well:
Sometimes the members _could_ have been kept in registers, but the
compiler cannot know that because as far as it knows bv_val may be
pointing back into bv, so it must re-read bv after changing bv_val[...].
(Of course another way would be to rewrite such code to extract the bv
members to a local variable, but that'd be more work per function.)
Howard Chu writes:
Hallvard B Furuseth wrote:
> (...) it might be an idea to disable _some_
> loglevels and some asserts in the default build. After we've done
> something about that broken log system of course - IIRC today one needs
> to turn on massive logging to get certain error messages.
Most error messages of any importance are logged at level -1, so they're
always displayed if any level of logging was enabled. I don't think this
particular area is really broken.
I'm fairly sure I've needed once in a while to turn on debug output to
see why som slap tool failed, at least. Haven't paid attention to when
it happens, I'll try to remember to report it next time it happens.
Certainly disabling debug support will give a sizeable performance
boost, but it will also make diagnostics impossible when anything goes
I dunno. Personally I'd be happy to lose TRACE and maybe ARGS from the
default, but then I haven't done anything like your amount of debugging.
I find myself asking users for loglevel STATS output more often than
TRACE - since people think it's a good idea to turn on full logging and
then only show the last lines of the log, cut off after the relevant
STATS log which might have been all that was needed.