two : 49.6 ns (x 5.5)
two+ : 64.8 ns (x 5.2)
three: 72.8 ns (x 5.6)
EDIT to add: above was just `cc`. Below is with `cc -O3 -Wall`, as in Lemire's article: two : 62.8 ns (x 7.1)
two+ : 69.2 ns (x 5.5)
three: 95.3 ns (x 7.3) (base) Coding % cc -mnative two-three.c
clang: error: unknown argument: '-mnative'
(base) Coding % cc -v
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Thread model: posixIt doesn't make much difference though, autovectorization doesn't work very well and there is not a lot of special optimization for newer x86 CPUs.
Only using 128 bit wide instructions on a core that has 512 bit hardware results in 4x less L1d bandwidth.
Type: DDR4
Speed: 2133 MT/s
I get two : 27.1 ns (3x)
two+ : 28.6 ns (2.2x)
three: 39.7 ns (3x)
which is not much, considering this is an almost 6 years old system with 2x slower memorLoad Avg: 2.36, 2.01, 1.97 CPU usage: 2.10% user, 3.39% sys, 94.49% idle
The M1 chip allows higher MLP, presumably because it has more LFB's per core (or maybe they are using different approach where the LFB's are not per-core?). I apologize for using so many abbreviations. I searched to try to find a better intro, but didn't find anything perfect. I did come across this thread that (apparently) I started several years ago at the point where I was trying to understand what was happening: https://community.intel.com/t5/Software-Tuning-Performance/S....