Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Zig doesn’t seem to have an implementation for the TechEmpower Benchmarks but Nim does: https://www.techempower.com/benchmarks/#section=data-r21&l=y...


Nim's should probably be redone with mummy (multi-threaded) and chronos (async single-threaded) for a better showing:

https://github.com/guzba/mummy

https://github.com/status-im/nim-chronos


Why does the stdlib implementation do so badly in the first place?


It is maybe the most simple web server implementation, similar to what you get from "python3 -m http.server"? What sense does it make to compare highly focused web server frameworks to languages most simple stdlib implementations, much apples vs oranges.. (thus also not getting why the proposal to compare with actual web frameworks for nim is that much downvoted?!)


Too much string copying iirc. It was written a while ago.

Hopefully it'll get updated/replaced some time, but there's plenty of faster 3rd party ones already.


And I'm surprised by how terribly it ranks – basically dead last against everything, even the Python frameworks, which is impressive.


Nim's default json library is terrible in performance, but there're much faster drop-in replacements like jsony[1]. I'm not sure that's the main issue for low rank, but it's definitely one of them.

1. https://github.com/treeform/jsony


I would not call std/json it "terrible in performance" probably still way faster then what you get in many other languages (like python). But yes the JSON lib I wrote is faster due to avoiding branches and allocations.


Interesting. The Vercel benchmarks make it look pretty good. Only slightly behind rust. https://programming-language-benchmarks.vercel.app/zig-vs-ru... Benchmarks are as much about the skill of the programmer as they are about the language. I suspect those numbers could improve drastically.


You've linked to Zig vs. Rust, which really should be outperforming Rust. The grandparent was talking about how Nim seems to be doing terribly.


httpbeast[1] reached #6 at one point, but I think the author is busy with other things nowadays.

https://www.techempower.com/benchmarks/#section=data-r18&hw=...

[1] https://github.com/dom96/httpbeast


Sums up most nim libraries unfortunatelly


Possibly it wasn't compiled with `-d:release`. I only looked briefly — is there a way to see the source code and cli flags used for the various implementations?


https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...

That appears to be the docker file they used, it's compiled with -d:release.


For reference, here's some other benchmarks which show happyx (a Nim framework) to come on top: https://web-frameworks-benchmark.netlify.app/result


It isn't really a language community so interested in web server efficiency, and until recent years threading efficiently was kind of tricky with the GC scheme they used. If someone wanted Nim to rank high you could do it, but I'm not sure it is worth the effort?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: