[PATCH] benchtests: Add memset zero fill benchmark tests

Wilco Dijkstra Wilco.Dijkstra@arm.com
Tue Jul 13 15:57:00 GMT 2021


Hi,

> I like the idea of a benchmark specific for 0 on memset. However having two
> implementations seems too much. I would rather see just one
> bench-memset-zerofill.c. What I guess would be even better is to have this
> performance test inside bench-memset.c and bench-memset-large.c.

I agree just copying the files is not a good idea. Currently bench-memset and
bench-memset-walk already test zero memsets. Bench-memset-large could just
test zero since that is the most common, especially for large sizes. Reducing the
number of non-zero tests in bench-memset would make it more representative -
you could do the main set of tests with zero only and then have a small selection
where it alternates between zero and non-zero.

> Quoting Naohiro Tamura via Libc-alpha (2021-07-13 05:22:14)
>> Memset takes 0 as the second parameter in most cases.
>> More than 95% of memset takes 0 as the second parameter in case of
>> Linux Kernel source code.
> The Linux Kernel does not use glibc, it has his own memset implementation.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/string.c#n784
> Therefore IMO this argument is not suited for this commit.

The argument is true in general - you could simply state that almost all memset
calls are zeroing without mentioning the Linux kernel. In some old stats from
SPEC I saw about 1.8% non-zero memsets.

Cheers,
Wilco


More information about the Libc-alpha mailing list