4 ms·
__restrict would have also helped. in the case of memset, it's questionable if that library call is actually faster for count < 128
by rurban 5y ago
__restrict would have also helped.
in the case of memset, it's questionable if that library call is actually faster for count < 128
- SuchAnonMuchWow 5y agoI believe restrict is a C only keyword, so no, it couldn't have helped.
- adzm 5y agoWhile not standardized, restrict or __restrict are indeed supported by most C++ compilers. Visual C++ even supports a declspec(restrict) that can apply to the function rather than just individual arguments.
- kevingadd 5y agosince it's std::memset, the compiler could theoretically inline it or have a small-count path that uses vector intrinsics
- bonzini 5y agoRecent Intel processors have "fast rep stos" which basically allows the compiler to always inline memset (which they couldn't do in the aliasing case).