Hacker News new | ask | show | jobs
by mortehu 4740 days ago
I mostly use linked lists when I need to allocate a bunch of stuff and it doesn't have to be contiguous, so I can avoid the cost of the mremap happening in a realloc() call. Linked lists aren't exactly a commonly used data structure by C or C++ programmers, due to their large storage overhead (usually one heap object and two pointers per item) and awful cache locality (heap object headers and list pointers between successive items).

You seem to suggest that there's a wide variety of linked list implementations whose existence you agree with, so at least you agree that some programmers should be making linked list implementations.

1 comments

the problem with linked list is the cost of cache misses from memory fragmentation killing any iteration. On a current x86 processor a linked list is death for performance. For light insert/deletions work vectors still outperform. However there's always the possibility that "linked list with a twist" may provide a unique solution to a specific problem.