3 ms·
That's not what the article is about nayuki. The author of the article makes and proves a claim that arrays are faster than linked lists regardless of the inser
by edejong 10y ago
That's not what the article is about nayuki. The author of the article makes and proves a claim that arrays are faster than linked lists regardless of the insertion point. The metrics presented clearly show this.
The reason for this abnormality is cache locality (there are other reasons, which I will not go into right here).
Balanced trees can be pretty slow in fact. After some operations, a tree structure can become quite fragmented in memory, leading to many cache misses. In my experience, it is often faster to work with arrays instead of trees when processing in memory. However, using external storage, a b-tree often introduces quite some performance gain.