My Experience of building Bytebeat player in Zig
5 comments
·November 4, 2025ww520
Arena Allocator is great, especially for periodic frame based allocations, e.g. rendering loop, game loop, request handling, etc. You just reset the arena at the end of every frame. It has the feature to reset and retain the memory allocated underneath. It's just a reset of the arena pointer.
bikeshaving
I would love to see a blogpost about the advantages of different Zig allocators (page, arena, fixed buffer, more?) and practical use-cases. Right now, I’m just thinking “this is the thing I pass through all my functions,” and it’s usually just the std.heap.page_allocator. Imagine we get to a period where people are writing games, web UIs, servers directly in Zig. I think the way allocators are used is likely to be the most interesting part.
kragen
I took a similar approach when I wrote a bytebeat player in CPython for a nightclub performance (https://github.com/kragen/pytebeat), but I used a shunting-yard parser rather than a Pratt parser.
null
From the description I thought the expression was a function of only 't', and there was no (for instance) accumulation of the previously computed byte. Then in the image I saw the same value of 't' evaluating to different values:
t=1000: 168 t=1000: 80
Reading the source: https://github.com/KMJ-007/zigbeat/blob/main/src/evaluator.z...
It does look like the expression is a pure function of 't', so I can only assume that's a typo.