5 ms·
> Modern functional programming languages generally come with compacting, generational garbage collectors that have bump allocators. This means in particular th
by charlieflowers 10y ago
> Modern functional programming languages generally come with compacting, generational garbage collectors that have bump allocators. This means in particular that the cost of heap allocations for temporaries is only marginally higher than that of alloca() and has good locality even for pointered structures
Interesting. Would you mind naming a few such languages? I'm guessing Haskell. What about OCAML? Any others?
- rbehrends 10y agoI know that OCaml, Haskell, the JVM and Microsoft .NET do it (I think Mono does, too, but am not positive). And I know for a fact that OCaml and the JVM inline allocations and optimize multiple allocations that are close together (e.g. increasing the allocation pointer only once even if you allocate a pair of objects). It's fairly common and needed for modern functional languages, as they can go through a lot of temporary objects when programming in a purely functional style.