Hacker News new | past | comments | ask | show | jobs | submit login

I don't have a benchmark, but it's important to remember that GCs only scan live objects, and they always have to scan all live objects; while allocation is normally an extremely simple instruction (bump the memory pointer). It's true though that scanning a live linked list would be expected to be slower than scanning a live array (though some optimized scanning strategies may be possible).

Overall I couldn't tell what the impact on overall performance would be, but I can tell you for sure that de-allocating an N-element linked list or array are both O(1) operations for a copying garbage collector (which are the most common kinds of compacting GCs), since they simply will never reach nor copy any of the elements.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: