▲ | zoogeny 4 days ago | ||||||||||||||||
I think the article buries a significant drawback: contiguity. It is obviously implied by the design but I think this approach would have hard-to-define characteristics for things like cache prefetching. The next address is a function, not an easily predictable change. One frequent reason to use an array is to iterate the items. In those cases, non-contiguous memory layout is not ideal. | |||||||||||||||||
▲ | dhooper 4 days ago | parent | next [-] | ||||||||||||||||
1. The image at the top of the article makes it clear the segments aren't contiguous 2. iterating a 4 billion item segmented array would have 26 cache misses. Not a big deal. | |||||||||||||||||
| |||||||||||||||||
▲ | forrestthewoods 4 days ago | parent | prev [-] | ||||||||||||||||
I would not call it “non-contiguous”. It’s more like “mostly contiguous”. Which for large amounts data is “amortized contiguous” just like a regular vector has “amortized constant” time to add an element. |