[PATCH] benchtests: Add sinf traces

Wilco Dijkstra Wilco.Dijkstra@arm.com
Thu Apr 9 09:49:24 GMT 2026


Hi Paul,

> Note there is little difference between the box2d traces for sinf. And while the
> speedup for box2d is 10% higher than the random input, they are not far off,
> so the random case shows the same issue.
>
>              sinf       cosf
>      random  45.4%      45.2%
>       large  68.0%      53.4%
>        huge  19.4%      9.8%
> box2d-small  58.2%      100.2%
>  box2d-hard  56.7%       72.7%
> box2d-mixed  52.5%      54.4%

> I did try to reproduce these figures on a Intel(R) Xeon(R) Silver 4214
> with gcc 15.2.0. Here is what "make bench" gives for the reciprocal-throughput
> of sinf with your "box2d" traces, both with glibc master and with the sinf
> patch contributed by Adhemerval. I prefer to give timings in cycles because
> these are very small numbers:
>
>               master   sinf patch
> box2d-small   8.2      10.4 (+27%)
> box2d-hard    9.9      12.6 (+27%)
> box2d-mixed   9.6      11.3 (+18%)
> 
> We can see that "sinf patch" is slower by less than 3 cycles in all cases.

So that shows a slowdown too, but not as large (possibly because Xeon 4214 is
older). The issue is that the number of cycles is small to start with - it's likely even
lower on newer cores (it's already below 5 cycles on Neoverse V2).

If an application spent 20% of its time in sinf/cosf, you'd see a 5% slowdown
on Xeon 4214 and 11% on Neoverse V2. This is why optimizing frequently used
math functions is worth it.

Cheers,
Wilco


More information about the Libc-alpha mailing list