Skip to content

Optimize loggers

Patches:

  1. 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).
  2. Makes libinput to not waste CPU cycles on a code that not gonna be needed in common usage (in particular it always executed snprintf in evdev_log_msg_va).
  3. 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.

Edited by Konstantin Kharlamov

Merge request reports