3 ms·
Depending on your GC, linked lists won't be "spread out in random locations." The nodes will be allocated right next to each other in the case where you're buil
by whateveracct 10y ago
Depending on your GC, linked lists won't be "spread out in random locations." The nodes will be allocated right next to each other in the case where you're building up a list iteratively.
- mohaine 10y agoHow does the GC change allocations? While I agree that this Linked list memory layout should be optimized, with real world tests Array backed normally win by a large margin.