frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

My Experience of building Bytebeat player in Zig

https://blog.karanjanthe.me/posts/zig-beat/
101•KMJ-007•3mo ago

Comments

kragen•3mo ago
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.
diek•3mo ago
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.

ww520•3mo ago
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•3mo ago
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.
mitchellh•3mo ago
The answer to this is not Zig specific (and predates Zig). I'm guessing good blog posts exist but I don't have a link handy, sorry. If not, I agree one should be written.

Don't sleep on the StackFallbackAllocator either, which will try to use a certain amount of stack space first, and only if it overflows that space will it fallback to another allocator (usually the heap but you can specify). This can speed up code a lot when the common case is small values with periodic very large values.

defen•3mo ago
> the common case is small values with periodic very large values

I find that a common scenario here is parsers where "Real world" input will tend to be small but you're also exposed to adversarial input. e.g. a parser for function prototypes would typically not expect to see more than 16 arguments in the wild, but you still need to handle it without erroring in case someone decides to send a 1000-argument function through your parser.

im3w1l•3mo ago
My thought when reading this, as someone who has never used zig, wouldn't it be easier with a global (thread local) variable? If you don't care you don't touch it. If you you do care you change it and restore it when you are done with whatever you were doing.
dundarious•3mo ago
That would get you almost none of the benefits of arenas and other types of allocators. Recommend https://www.rfleury.com/p/untangling-lifetimes-the-arena-all...
im3w1l•3mo ago
I know what arenas are but I don't see how passing something explictly vs implicitly matters except for which style people prefer?
dundarious•3mo ago
For one, you don't want exactly one arena or allocator for all tasks.
im3w1l•3mo ago
Well you couldn't you just use a different one in that case? The variable would just be like a suggestion.
dundarious•3mo ago
Most programmers don't prefer thread local mutable state over a single pointer argument. Especially for general purpose code (i.e., not specific to a single purpose/project). With the mutable state version, you have to clearly define which state you're using and when (which named allocator/arena variable), and if you're mutating it in place and then restoring it, there can be some pretty obvious issues.

Given this thread is completely off the rails from anything specific to allocators or arenas, and even Zig, I will now exit.

chrisco255•3mo ago
You can use regular buffers for many things, but a lot of core Zig std functions require an allocator (satisfying std.mem.Allocator interface) as an argument. This means the developer retains control of how memory is managed. It's also advantageous for testing, as you can pass in specialized allocator for detecting memory leaks during testing but use the more efficient allocator for release mode. You can wrap regular buffer into a FixedBufferAllocator which just uses stack values. ArenaAllocator is just a container that wraps an underlying allocator but it will free everything when you call defer arena.deinit(), which is useful for short-lived things like http requests.
defen•3mo ago
Doing that seems like it's just manually replicating a call stack (with potential for error); I don't see what the benefit is. Making functions independent of global state - and allocation is a huge source of implicit dependency on global state - is generally considered good programming practice.
throwawaymaths•3mo ago
please remember that the page allocator makes an expensive kernel call on each alloc/free call, so if allocation is frequent you may want at least a bump allocator on top. if you don't mind linking libc, for default use cases, c_allocator might be a better choice, as malloc is a quite battle tested general purpose allocator.

France's homegrown open source online office suite

https://github.com/suitenumerique
207•nar001•2h ago•110 comments

Start all of your commands with a comma (2009)

https://rhodesmill.org/brandon/2009/commands-with-comma/
374•theblazehen•2d ago•134 comments

Hoot: Scheme on WebAssembly

https://www.spritely.institute/hoot/
65•AlexeyBrin•3h ago•12 comments

Reinforcement Learning from Human Feedback

https://arxiv.org/abs/2504.12501
40•onurkanbkrc•3h ago•2 comments

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
749•klaussilveira•18h ago•234 comments

Coding agents have replaced every framework I used

https://blog.alaindichiappari.dev/p/software-engineering-is-back
108•alainrk•2h ago•117 comments

The Waymo World Model

https://waymo.com/blog/2026/02/the-waymo-world-model-a-new-frontier-for-autonomous-driving-simula...
1002•xnx•23h ago•569 comments

Show HN: One-click AI employee with its own cloud desktop

https://cloudbot-ai.com
7•fainir•1h ago•2 comments

First Proof

https://arxiv.org/abs/2602.05192
11•samasblack•33m ago•5 comments

Stories from 25 Years of Software Development

https://susam.net/twenty-five-years-of-computing.html
6•vinhnx•1h ago•1 comments

Vocal Guide – belt sing without killing yourself

https://jesperordrup.github.io/vocal-guide/
132•jesperordrup•8h ago•55 comments

Unseen Footage of Atari Battlezone Arcade Cabinet Production

https://arcadeblogger.com/2026/02/02/unseen-footage-of-atari-battlezone-cabinet-production/
91•videotopia•4d ago•20 comments

Ga68, a GNU Algol 68 Compiler

https://fosdem.org/2026/schedule/event/PEXRTN-ga68-intro/
30•matt_d•4d ago•6 comments

Making geo joins faster with H3 indexes

https://floedb.ai/blog/how-we-made-geo-joins-400-faster-with-h3-indexes
148•matheusalmeida•2d ago•40 comments

Reputation Scores for GitHub Accounts

https://shkspr.mobi/blog/2026/02/reputation-scores-for-github-accounts/
6•edent•2h ago•0 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
253•isitcontent•18h ago•27 comments

Monty: A minimal, secure Python interpreter written in Rust for use by AI

https://github.com/pydantic/monty
266•dmpetrov•18h ago•142 comments

A Fresh Look at IBM 3270 Information Display System

https://www.rs-online.com/designspark/a-fresh-look-at-ibm-3270-information-display-system
6•rbanffy•3d ago•0 comments

Show HN: Kappal – CLI to Run Docker Compose YML on Kubernetes for Local Dev

https://github.com/sandys/kappal
10•sandGorgon•2d ago•2 comments

Hackers (1995) Animated Experience

https://hackers-1995.vercel.app/
531•todsacerdoti•1d ago•258 comments

Sheldon Brown's Bicycle Technical Info

https://www.sheldonbrown.com/
409•ostacke•1d ago•105 comments

Show HN: I spent 4 years building a UI design tool with only the features I use

https://vecti.com
353•vecti•20h ago•159 comments

Show HN: If you lose your memory, how to regain access to your computer?

https://eljojo.github.io/rememory/
321•eljojo•21h ago•198 comments

An Update on Heroku

https://www.heroku.com/blog/an-update-on-heroku/
448•lstoll•1d ago•296 comments

What Is Ruliology?

https://writings.stephenwolfram.com/2026/01/what-is-ruliology/
54•helloplanets•4d ago•54 comments

Microsoft open-sources LiteBox, a security-focused library OS

https://github.com/microsoft/litebox
365•aktau•1d ago•190 comments

Cross-Region MSK Replication: K2K vs. MirrorMaker2

https://medium.com/lensesio/cross-region-msk-replication-a-comprehensive-performance-comparison-o...
6•andmarios•4d ago•1 comments

How to effectively write quality code with AI

https://heidenstedt.org/posts/2026/how-to-effectively-write-quality-code-with-ai/
292•i5heu•21h ago•246 comments

Dark Alley Mathematics

https://blog.szczepan.org/blog/three-points/
103•quibono•5d ago•30 comments

Female Asian Elephant Calf Born at the Smithsonian National Zoo

https://www.si.edu/newsdesk/releases/female-asian-elephant-calf-born-smithsonians-national-zoo-an...
53•gmays•13h ago•22 comments