Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>but because the GC encourages (fails to discourage) a lot of allocations.

Yeah, but allocations in OCaml and Haskell are super cheap, nearly as cheap as on stack. Typical OCaml small allocation is:

  * add the number of words you wanna allocate to the heap pointer (%r15 on amd64)

  * check if it surpassed the limit

    + if it's fine — just write your data in -8(%r15)

    + if there is no space left — run GC


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

Search: