Hacker News new | ask | show | jobs
by zokier 2744 days ago
I feel like it should be possible to avoid dynamic memory allocation completely during the request processing/parsing. Sure, fixed-sized buffers generally imply some memory overhead, but I'd think the overall effect on performance would be beneficial.
1 comments

This is what I'm trying to do with wwwee [1], a low-resource web server written in Rust. The request / response buffer is a growing anonymous mmap mapping, but all parsing (http headers, ...) and decoding (base64, JSON) is done borrowing from the buffer. It works especially well in Rust, with it's borrow checker preventing use-after-free.

1: https://github.com/bwindels/wwwee/