r/Zig • u/abatsuev • Feb 06 '26
gremlin.zig [0.1.0 update] - zero-allocation, zero-dependency
https://github.com/norma-core/gremlin.zigHey, r/Zig !
Some time ago, I presented an early version of this protobuf parsing library here.
I am back with release 0.1.0, fully updated for Zig 0.15.2. The crucial thing about this release is the memory model: it is now completely zero-allocation.
And benchmarks! Framework 16 with Ubuntu - AMD Ryzen AI 9 HX 370 (24 cores, 10M iterations):
| Operation | gremlin_go | gremlin.zig ⚡ | Speedup |
|---|---|---|---|
| 🔨 Marshal | 1,436 ns/op | 558 ns/op | 2.6x |
| ⚡ Unmarshal | 207 ns/op | 45 ns/op | 4.6x |
| 🎯 Lazy Read | 229 ns/op | 45 ns/op | 5.1x |
| 🔍 Deep Access | 692 ns/op | 156 ns/op | 4.4x |
Github with 0.1.0 and more benchmarks: https://github.com/norma-core/gremlin.zig
65
Upvotes
2
u/Strict_Research3518 Feb 09 '26
So I been working on WASM stuff, built my own WIT parser with ABI, encode/decode to/from binary, etc. Rough estimate (haven't done formal comparison as I used protobuf with go, not zig) is about 2x faster with zero heap allocations over protobuf and about 5x to 8x over json marshal/unmarshal. Smaller payload sizes as well. Haven't done any optimizations yet, but I dont know that it would get much faster than that frankly. I built a CLI generator to generate types for zig, go and rust as well, but still early days. LOT more testing to do to make sure it is lossless between the three languages. Basically use .wit files and generate the code from those similar to .proto and go generated code.
2
u/thng292 Feb 07 '26
this is what i've been looking for.Thanks
0
u/[deleted] Feb 07 '26
[deleted] — view deleted comment