3 ms·
"Practically O(1)" is meaningless. If it's not actually constant time, then how does it grow?
by TillE 10y ago
"Practically O(1)" is meaningless. If it's not actually constant time, then how does it grow?
- Tuna-Fish 10y agoEvery operation that is not actually constant time grows by log32. Or in other words, by no more than the constant factor 5. In practice, these data structures live and die by your memory allocator. They do so many allocations that unless you are using a world-class GC, the memory allocation costs completely overshadow any other time costs. Using the typical platform malloc, or even jemalloc or it's ilk, this will be very slow indeed.
- Syzygies 10y agoYes. This begs for a port to Rust, to see if the fine-grained memory support there pays off. While Rust can do anything, it wants to be bare-metal Haskell.
- Kutta 10y agoYes. Copying GC with bump pointer allocation is critical for pretty much any persistent data structure. In C++ and Rust one should use memory pools/arenas for them instead.
- saasinator 10y ago"Practically O(1)" == amortized constant time?