]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: sample: don't check casts for samples of same type
authorWilly Tarreau <w@1wt.eu>
Sun, 15 Sep 2024 10:40:25 +0000 (12:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 15 Sep 2024 10:43:56 +0000 (12:43 +0200)
commit51ade2f1dbf12873d1f56b8d49c75dfe6b2cb34a
treecc4c74bf8eef236dbd7d70826b27c932c86701b7
parentb11495652e724d71f1f4247332f060fe48577664
OPTIM: sample: don't check casts for samples of same type

Originally when converters were created, they were mostly for casting
types. Nowadays we have many artithmetic converters to perform operations
on integers, and a number of converters operating on strings. Both of
these categories most often do not need any cast since the input and
output types are the same, which is visible as the cast function is
c_none. However, profiling shows that when heavily using arithmetic
converters, it's possible to spend up to ~7% of the time in
sample_process_cnv(), a good part of which is only in accessing the
sample_casts[] array. Simply avoiding this lookup when input and ouput
types are equal saves about 2% CPU on such setups doing intensive use
of converters.
src/sample.c