I had a similar comment thread on Hacker News post on Zig. The Zig creator claimed that "no other modern languages matched its low memory footprint". Fairly ridiculous claim if you ask me given not just Nim, but Rust, D, heck even Go, Vala, C++20, and Swift. Unfortunately many developers without experience in writing software concerned with memory footprint will believe it (and not realize it's also _not_ a memory safe language). In real usage there's almost always tradeoffs between halfway decent languages.
Eventually I ran a semi-random benchmark that seemed to have a decent memory usage overhead (<https://github.com/kostya/benchmarks/tree/master/brainfuck>). The Nim code was decently written. I had to fix the Zig code (it's pre-1.0 so fair enough), but it was annoying to figure out how to convert i32 to the u64 indexes. Otherwise both implementations were almost identical along with the Rust and Go versions. Here's the results as I posted to HN: > Curiosity got to me, perhaps Zig had improved significantly. So I compared > the first benchmark I found (kostya/benchmarks/bf) with Zig with Nim. For the > smaller input (bench.b) Zig did run with ~22% less RAM (about 20kB less). > However, for the larger input (mandel.b) Nim+ARC used ~33% less RAM in safe > mode: Nim 2.163mb -d:release; Zig 2.884mb -O ReleaseSafe; Zig 2.687mb -O > ReleaseFast. The Nim requires 0.5mb less ram and the code is ~40% shorter. I > don't have time to try out the Rust or Go versions though. It was interesting too that changing Nim to use int32's or `{.packed.}` structs actually _increased_ the memory usage. Nim was a bit slower unless compiled with `-d:danger` but I was a bit surprised how well Nim's `seq` and `iterator` did when combined with ARC compared to a manual memory management. I'd expected equal memory usage with larger brainkfuck programs, not 30% less. I am curious how the Rust & Go versions compare.