Optimize loggers
Patches:
- Moves loggers into headers (as is already done in evdev.h), so compiler could make optimizations based on the code (e.g.
unlikely
macro added in patch 3). - Makes libinput to not waste CPU cycles on a code that not gonna be needed in common usage (in particular it always executed
snprintf
inevdev_log_msg_va
). - Exploits fact that common users don't need the prints, so compiler should optimize for branch with prints as a unlikely one. The idea of macro is taken from mesa. In there it's surrounded by a
#ifdef GCC_OR_CLANG
, but I see libinput don't have other__attribute__
s guarded, so neither did I.
I found there's too many logger function around. I wonder, if further clean up is possible by converting them into variadic macros, to get rid of passing around the va_args
.