- (author here) I'm just adding data-race free parallelism support to this right now to switch my website over to using it! For those familiar with OCaml syntax, the OxCaml parse function is fun:
val parse : buffer -> len:int -> #(status * request * header list) @ local
This takes in a buffer and returns an unboxed tuple on the stack, so there's no GC activity involved beyond stack management for each HTTP request.https://github.com/avsm/httpz/blob/main/lib/httpz.mli#L154
- "Zero heap allocations: Parser results are stack-allocated using OxCaml unboxed records and local lists" - honest question, why?
On almost any platform on which you want to run a HTTP server - including bare metal - it usually doesn't matter if you keep state near the stack pointer or not. What matters is that you use it well, making it play well with CPU caches, etc. Or is there something specifically horrible about OxCaml's heap allocator?
- > Local lists (@ local): Header list grows on the stack, not heap
Does this mean unbounded stack growth? I'd much rather heap allocation if that's the case, as at least that can be recovered from in the case of allocation failure (assuming your OS, language, and stdlib allow for it).
by spooneybarger
0 subcomment
- The OxCaml work is great. I don't use OCaml much but I have been following along with OxCaml as they are doing fascinating work that leverages a lot of research that interests me.
- ocaml looks more like a spec than actual code.
by infamouscow
0 subcomment
- I'm excited to see what comes of OxCaml the next few years.