Hi Aaron,

On Sun, 2025-09-21 at 21:30 -0400, Aaron Merey wrote:
> Calls to the gettext _() macro in hotpaths results in unnecessary lookups
> of the same translation strings during runtime.
> 
> Avoid this performance cost by calling _() for hotpath strings just once
> and storing the results.  Runtime speedup of up to 17% has been observed
> with this patch applied.
> 
> Signed-off-by: Aaron Merey <[email protected]>
> ---
> 
> v2 changes:
> No longer introduces a new macro __() that caches the translation
> strings at fprintf callsites.  Instead cache strings once near the
> beginning of the main function, just like yes_str and no_str.

I like this solution much better. Looks good to me.

The only oddness is where we use whitespace to right align some values,
like the headers in print_debug_line_section. Not sure how translations
would handle that. But it is unclear they did before, so given this
speeds up things a lot lets go with this.

Thanks,

Mark

Reply via email to