5 ms·
This is the benchmarking loop: for (size_t i = 0; i < N; i++) { out[i++] = g(); } N is 20000 and the time measured is divided by N. [1] However, that
by ascar 6y ago
This is the benchmarking loop:
for (size_t i = 0; i < N; i++) {
out[i++] = g();
}
N is 20000 and the time measured is divided by N. [1] However, that loop has two increments and only computes 10000 numbers.
This is also visible in the assembly
add x8, x8, #2
So if I see this correctly the results are off by a factor of 2.
[1] https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/blob/master/2021/03/17/fastestrng.cpp#L58-L60 https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/...
- HelloNurse 6y agoA C for statement is a "benchmarking loop" in the same sense that "slice a sponge cake into two layers and place custard in the middle" is an actionable dessert recipe.
- ascar 6y ago> Update: The numbers were updated since they were off by a factor of two due to a typographical error in the code. The article got updated by now :)
- gpderetta 6y agoYes, the i++ seems an oversight. The relative speed between the two hashes is still the same, but it is no longer one iteration per cycle.