logoalt Hacker News

avsmtoday at 11:54 AM4 repliesview on HN

The big win here is having a GC by default, with the ability to reduce heap allocations (via stack) just by adding in more typing annotations.

    Switching to OxCaml with exclave_ stack_ annotations drops 
    p99.9 latency from 29 ns to 9 ns per packet on the dispatch
    hot path, and removes GC pressure entirely (394 minor GCs to
    zero over 25 million packets). Throughput is comparable [...]
I got a similar result with my 'httpz' stack a few months ago (https://anil.recoil.org/notes/oxcaml-httpz) which my website's been running on without drama. And, I gotta say, OxCaml's a surprisingly robust compiler for being packed full of bleeding edge extensions: not a single crash on my infra is attributable to a compiler bug (plenty of bad OCaml code, but not due to a compilation bug)

Replies

Shooptoday at 1:13 PM

I think robustness is helped a lot by the fact that it’s the production compiler used at Jane Street

show 1 reply
runevaulttoday at 6:00 PM

It is interesting seeing more and more GCed ecosystems become aggressive about allowing code to stack allocate more. Watching dotnet go through it since I think Core 2.1, or whenever they introduced Span<T>, Memory<T>, etc to get significant performance gains has been nice to track.

GCed languages do not have to be slow if you keep the garbage to only where it is necessary (or where you can allocate once and never collect).

show 1 reply
pjmlptoday at 6:20 PM

Yes, just like PTC and Aicas have been delivering real time GC with their embedded Java toolchains, microEJ, Astrobe with Oberon, and Meadow with their micro kernel + .NET.

Mentally only gets changed with people pushing against "this is how it has always been".

Also great to see the OCaml improvements, as my first ML was Caml Light.

netbioserrortoday at 1:21 PM

Nim does much the same. It prefers the stack, wraps dynamic heap types in value-semantic unique pointers by default, and avoids implicit copies wherever it can. I could see compiled languages trending in the stack-managed direction long term.

show 1 reply