I’ve seen a very nice and well made benchmark of Zig Zap framework vs Rust Actix framework, the results aren’t really optimal but this is because the author forgot to use -Doptimize=ReleaseFast
. He’s asking members of the community for help in giving Zig a fair comparison, so if anyone can spot something that is leading to an unfair comparison you can make a PR on his repo
The author voice sound robotic and it is so bad that I cannot follow the video.
Reducing the speed to 0.9x can fix this. But the author should not increase the audio speed in the first place.
The comparison doesn’t really make sense since Zap is largely just a Zig wrapper for the facil.io library, written in C with quite a few inefficiencies/limitations and slowly bitrotting away.
It makes sense to me. It would be great if there was a popular pure-Zig web backend server, but there isn’t, there’s Zap. Also, “easily build on C libraries” is a prominent Zig feature.
But mainly, you can’t compare Actix with something which doesn’t exist. I’m not a fan of clickbait “this language vs. that language” videos and blog posts anyway, because it’s very difficult to make a fair comparison, or even decide what a fair comparison is.
Most of the time what’s measured is familiarity with the languages, as evidenced by not even doing a ReleaseFast build in this case. If someone’s skill set looks like “routinely optimize Language A, still figuring out all the basics of Language B”, that’s going to show up in benchmarks.
Still, “Pure Zig evented Web backend” would be another good one to put on the big projects list. Pretty far outside of my area of interest, but I expect I’m in the minority on that one.
It is weird that the author of the video doesn’t know how to increase buffer size in order to return larger JSON response. He should probably make it heap allocated to be comparable to Rust implementation?
Also Rust is evented and Zap is threaded. He uses 2 workers for Rust and 1 worker with 2 threads for Zig. Not sure that this setup is comparable. IMO he should experiment with multiple workers for Zig and increased number of threads.
zap’s core logic is in C… this comparison does not really make sense and I don’t think it’s accurate to say that Zap is “a zig web framework”.
I also think it’s cringe to put “blazingly fast” and “extremely robust” in the readme. It’s like calling a sorting algorithm “quick”. Show, don’t tell. If it’s fast, show us that it’s fast via demos and benchmarks. If it’s robust, explain the testing methodology. Let the user make their own conclusion.