News for hackers. Stuff that matters.
Re:What's new in purely functional data structures since Oka... by scott_s on Monday February 08, 2016 @10:56PM (#11062963)
I would be shocked if the GC performed better. I think you are severely over-estimating how expensive the fast-path for memory allocations are. For this example, decent memory allocators will execute on the order of a dozen instructions for each malloc and free call - no need to allocate new slabs in the allocator, no need to free old ones, no interactions with the operating system or even the internal slab allocator.

Calling free is not what is expensive. It's what we do when we call free. GC has to do more work because it has to figure things out. Manual memory allocation does not need to spend any instructions figuring anything out because the programmer has already done that. As I have said before, decent memory allocators will keep returning the exact same address for each malloc call in this situation. That is the ideal situation for this case.

Also keep in mind that larger heap sizes don't come for free - that means more page faults, which will slow you down.

There are no comments on this comment yet.