]> git.ipfire.org Git - thirdparty/knot-resolver.git/commit
tweak inlining
authorVladimír Čunát <vladimir.cunat@nic.cz>
Tue, 24 May 2022 09:35:14 +0000 (11:35 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 9 Jun 2022 09:13:46 +0000 (11:13 +0200)
commit5bd8a765bd9b959064c22c20ff6f62a60ab4e1de
tree4dd430a7ef2e24d437cfd1a68c31c3a4474e6008
parentcef176bbcab6d2b30a73a17466aefdf0ab4ecf13
tweak inlining

I used -Winline (optimizing, gcc 11 or 12) to gather warnings
about cases that were considered too expensive for inlining.
Some of these probably used not to happen when we were dropping
assertions during preprocessing in -DNDEBUG builds.
This commit mainly improves size of the compiled binary by several KiB.

- queue_head_impl(): optionally (un)inline; not big but in warnings
- queue_pop_impl(): uninline; too complex for my today's eyes
- kr_rand_bytes(): optionally (un)inline
  The inlining potential there comes from calling with a constant.
- kr_straddr(): uninline.  It's never been meant for hot code,
  and this gives us large savings due to deduplicating the static array.
- For some I couldn't see a good resolution due to restrictions in C.

C hint: `static inline` is probably well known;
the other inline combination is well explained at:
https://stackoverflow.com/a/6312813/587396
lib/generic/queue.c
lib/generic/queue.h
lib/utils.c
lib/utils.h