Pointer Chasing
Node* p = head;
while (p) {
sum += p->value;
p = p->next;
}
^ This is Faster?
for (auto i = 0u; i < arr.size(); ++i) {
sum += arr[i];
}
^ This is Faster?
* The benchmark is run under AMD Ryzen 9.
* For the full benchmark code, please refer here.
* For illustration purposes only, see FAQ for more details.