write_prometheus plugin: Improve performance of metric_cmp().
authorFlorian Forster <octo@collectd.org>
Sat, 1 Oct 2016 19:22:12 +0000 (21:22 +0200)
committerFlorian Forster <octo@collectd.org>
Fri, 11 Nov 2016 13:42:03 +0000 (14:42 +0100)
commit3d2dcd7b53979a1050ad632ac4881c2a7dd618af
tree80fa2169ec97de3585a4cf338e8cc930513ec5ca
parent649a826ba0792bf4f48968c879011c6e1bcbc64a
write_prometheus plugin: Improve performance of metric_cmp().

This function is a hotspot because it is used by bsearch() to look up
metrics in a metric family. This simple (though non-obvious) change
brings prom_write() complexity down from 3000 instructions/call to 2640
instructions/call, i.e. a 12% improvement.
src/write_prometheus.c