Sujet : Array vs. Linked List Traversal
De : jseigh_es00 (at) *nospam* xemaps.com (jseigh)
Groupes : comp.archDate : 01. Aug 2024, 15:55:57
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8g7lr$27dq5$1@dont-email.me>
User-Agent : Mozilla Thunderbird
It's claimed that array traversal is faster than linked list traversal. What would be the reasons for that?
Array elements being in cache, assuming the element size is small enough to fit multiple elements in a cache line?
No dependent load delay from having to load the linked list next pointer? If that was the case, then moving the load of the next pointer to the beginning of the loop should ameliorate that somewhat.
Something else?
Joe Seigh