5 ms·
Not sure what you mean by 'part'. I reproduced this across the following CPUs, which I think are fairly representative: - intel xeon e3-1246 - intel core i3-
by moonchild 6y ago
Not sure what you mean by 'part'. I reproduced this across the following CPUs, which I think are fairly representative:
- intel xeon e3-1246
- intel core i3-5005u
- amd ryzen 3960X
- amd epyc 7402p
Comparing my own[0] memset implementation, glibc's, and bionic's.
0. https://github.com/moon-chilled/fancy-memset https://github.com/moon-chilled/fancy-memset
- jeffbee 6y agoIt seems that you do know what I mean by part. Only the latest Zen3 parts have ERMS and FSRM. I think that benchmarking memset by itself is folly, because you may end up with a very large function that is fast on its own, but which trashes your icache when run in a real application. That is the conclusion of the paper I linked elsewhere in this thread: that rep cmpsb, even on old CPUs where it is slow, beats glibc memcmp in real full-scale applications because glibc memcmp is 6KB long and has a tendency to evict dozens of lines of icache. memset, memcpy, and memmove have the same hazard.
- moonchild 6y agoThat is a good point, and I do intend to do full-scale application benchmarks; I just haven't gotten around to it yet. That being said, all the implementations of memset I tested except for glibc's are in the neighborhood of 100-300 bytes (also including the freebsd version, which doesn't use any simd), which is a fair sight smaller than 6k.