Hacker News new | ask | show | jobs
by thelema314 5601 days ago
Actually, OCaml never generates objects like this on the stack - value creation is always taken literally. The OCaml compiler is really allocating all those records. It's just that their lifetime is almost zero, so the cost to clean them up is zero (as none get promoted from the minor heap to the major heap). And the cost to create them is almost zero, just a += and a compare.
1 comments

Ah, interesting. Does it also have a GC or some own custom allocation implementation?

Because if it really would use something like malloc, I don't really see how it should be faster than the C version.