Why We Built Lightpanda in Zig
23 points by krig
23 points by krig
I posted this mainly to make this comment:
Each page load gets its own arena. When the page is done, we throw away the entire memory chunk. No tracking individual allocations, no reference counting overhead, no garbage collection pauses. (Though we’re learning that single pages can grow large in memory, so we’re also exploring mid-lifecycle cleanup strategies).
The parenthesis here feels like a smell. I suspect that there are other lifetimes at play here where a separate arena or temp allocator would resolve the memory usage of the page. "mid-lifecycle cleanup" seems to indicate that there are temporary allocations with a shorter lifespan. Adding some kind of garbage collection to the page allocator seems like the wrong approach to me.
The Postgres approach of using a stack of arenas, corresponding to nested lifetimes, might apply here.
Glad to see how many Zig stories are showing up here and on Hacker News.
Less about zig and specific to Lightpanda but:
Anyway thankfully it's open source so at least for #1 the change is quite simple, but it would make the browser so much more useful for crawling...