diff options
author | Aaron Merey <[email protected]> | 2025-06-29 23:51:55 -0400 |
---|---|---|
committer | Aaron Merey <[email protected]> | 2025-07-03 14:24:57 -0400 |
commit | ce8906bd74bfc8dec72ef1891f998c1c57849789 (patch) | |
tree | 23166e3db5095e5d434716e06ec94648f6862fc3 /SECURITY | |
parent | 56d9896abcb8a9a648192d570635f519c4a63021 (diff) |
readelf.c: Avoid repeating calls to gettext _() in hotpathupstream/users/amerey/try-readelf-concurrency
Calls to the gettext _() macro in hotpaths cause many runtime lookups
of the same translation strings. This patch introduces macro __()
which caches the result of _() at each call site where __() is used.
When a cached translation string is used as the format string for
fprintf, the compiler might raise a -Wformat-nonliteral warning.
To avoid this, the -Wformat-nonliteral warning is suppressed using _Pragma
around affected fprintf calls, using IGNORE_FMT_NONLITERAL_BEGIN and
_END wrappers.
To avoid suppressing -Wformat-nonliteral across every printf-style
function using _(), __() and IGNORE_FMT_NONLITERAL_* are mostly used
within hotpath loops where caching makes a signficant difference.
Runtime improvements of up to 13% faster have been observed with this patch
applied.
Signed-off-by: Aaron Merey <[email protected]>
Diffstat (limited to 'SECURITY')
0 files changed, 0 insertions, 0 deletions