Here is another benchmark.
In this benchmark we observe a typical situation when processing of buffer occur. Specifically in current case we take chunk of buffer getting bitmask from it (procedure PosRangeMask, uses SIMD) then analyze this bitmask together with buffer. Our task is to extract positions and lengths of numbers in generated string. The difference is the size of buffer we test. The initial idea is that smaller buffer sizes (that fit into L1 cache) should show better performance.
Benchmark is ready for x86 and AArch64. (Linux code not tested)
In left column size of our buffer, in right column coefficient of speed (1.000x is the fastest). Also for comparison added "simple" realization of the same algorithm that don't use SIMD.
Results from Intel Core Ultra 7 258V:
4096 1.430x
8192 1.024x
16384 1.006x
32768 1.000x
65536 1.021x
131072 1.012x
Simple 2.374x
4096 1.153x
8192 1.013x
16384 1.215x
32768 1.082x
65536 1.000x
131072 1.135x
Simple 2.228x
4096 1.360x
8192 1.052x
16384 1.021x
32768 1.000x
65536 1.106x
131072 1.293x
Simple 2.413x
4096 1.263x
8192 1.021x
16384 1.014x
32768 1.000x
65536 1.034x
131072 1.087x
Simple 2.284x
4096 1.560x
8192 1.109x
16384 1.145x
32768 1.051x
65536 1.000x
131072 1.004x
Simple 2.115x
Results from Raspberry Pi 5:
4096 1.033x
8192 1.031x
16384 1.036x
32768 1.025x
65536 1.040x
131072 1.000x
Simple 1.665x
4096 1.269x
8192 1.224x
16384 1.001x
32768 1.000x
65536 1.013x
131072 1.130x
Simple 1.938x
4096 1.015x
8192 1.009x
16384 1.020x
32768 1.000x
65536 1.096x
131072 1.125x
Simple 1.632x
4096 1.134x
8192 1.128x
16384 1.114x
32768 1.118x
65536 1.154x
131072 1.000x
Simple 1.763x
4096 1.252x
8192 1.375x
16384 1.137x
32768 1.000x
65536 1.037x
131072 1.085x
Simple 2.002x
Observations:
1. On Intel best results are shown on buffer sizes 16Kb and 32Kb. This seem to be expected, because L1 cache size on Intel is 32Kb.
2. On Raspberry best results are shown on buffer sizes 32Kb and 131Kb. This is kind of unusual, because cache size on this CPU is 64Kb.
3. SIMD based code on Intel is ~2.3 times faster than simple realization.
4. SIMD based code on Raspberry is ~1.8 times faster than simple realization.
In general buffer size don't play a big role, except situation when you take very little (like 4Kb) or very large buffer.