cache_compare() is one of the hottest functions in collectd. Depending how many
metrics collectd handles (how deep the tree is) it gets called an order of
magnitude or two more often than the number of metrics handled. With 100k
metrics, about 6.6% of the CPU time were spent within cache_compare(), with
this commit this reduces to 6.3% (that's, uhm, 4.7% faster?).
static int cache_compare (const cache_entry_t *a, const cache_entry_t *b)
{
+#if COLLECT_DEBUG
assert ((a != NULL) && (b != NULL));
+#endif
return (strcmp (a->name, b->name));
} /* int cache_compare */