3 ms·
>Tiny ~6mb binary I wonder why it's so large for a program written in Zig. It's basically just a loop that accepts user input, prepares the context, sends it t
by kgeist 1mo ago
>Tiny ~6mb binary
I wonder why it's so large for a program written in Zig. It's basically just a loop that accepts user input, prepares the context, sends it to the LLM, parses the output, invokes the tools, and presents it all in the terminal. Add the built-in prompts and a few checks here and there (like blocking a write tool call before the file has been read first), and I'd expect a truly tiny native agent to be around 200-300 KB max.
- miguel_martin 1mo agofwiw, here's 3code which is 1.6MiB written in Nim - https://3code.capocasa.dev/ https://3code.capocasa.dev/
- wyre 1mo agoI was looking it last night and the repo is something like 600k lines of Zig. Maybe 500k after comments and blank lines. In my own experiments to build a tiny zig agent it came out to under 800kb.
- rjzzleep 1mo agoI think the problem is that when you use agents to write Zig it will bruteforce code, because there isn't that much good reference code to work off of.
- usef- 1mo agoI'm always surprised how large harnesses are By comparison, the recently open sourced grok harness was 840k lines, codex 950k, pi 250k https://simonwillison.net/2026/Jul/15/grok-build/ https://simonwillison.net/2026/Jul/15/grok-build/
- irishcoffee 1mo agoSo large? Really? Allow me to introduce you to electron.
- pjmlp 1mo agoThose of us educated in 70's and 80's home computing have several nice words for stuff like Electron.
- klibertp 1mo agoYes, large. I haven't used Zig much myself, but from a few experiments I ran, Zig handles dead code elimination exceptionally well. It compiled a full Win32 GUI calc app that used Capy (a full, cross-platform GUI framework) into a 133kb executable. Removing Capy completely and using Win32 APIs directly produced an even smaller (93kb) binary (it also removed some DLL dependencies, leaving basically only ntdll.dll). For the same task, Rust + Slint produced a 4.7 MB binary that still depended on multiple (non-Windows-provided) shared libraries. Given another commenter's mention of a similar project written in Nim that yielded a 1.6 MB binary, my first guess is that the 6 MB Zig binary simply isn't optimized for size - it might be a debug build. If not that, then I'm not sure what's happening, but yeah, in the context of Zig, 6mb for a CLI app is a bit strange.
- irishcoffee 1mo agoHa, it’s not.