A Quick Comparison of Nim vs. Rust
arthurtw.github.io
A Quick Comparison of Nim vs. Rust
1–10 of 94 posts
Re: A Quick Comparison of Nim vs. Rust
#2That's actually not surprising: a large fraction of time is spent in the map lookup, which in Rust is implemented as a B-tree, thus lookup time is (mildly) dependent on the map size. If keys are lowercased before inserting them, the map ends up having fewer elements.
The Nim version uses instead hash tables, whose lookup time is near-constant (that is, excluding memory hierarchy effects).
Re: A Quick Comparison of Nim vs. Rust
#3You should also use the re module, PEGs is not nearly as optimized as PCRE.
Re: A Quick Comparison of Nim vs. Rust
#4Re: A Quick Comparison of Nim vs. Rust
#5Are you just using --opt:speed to compile the Nim examples? For maximum performance you should be using -d:release.
Re: A Quick Comparison of Nim vs. Rust
#6Are you just using --opt:speed to compile the Nim examples? For maximum performance you should be using -d:release.
-d:release disables bounds checking, so the Rust examples would have to be modified for unchecked indexing for a fair comparison.
Re: A Quick Comparison of Nim vs. Rust
#7Re: A Quick Comparison of Nim vs. Rust
#8I'm starting to really wish there was a GC-free (or at least) GC optional version of Nim. Nim with Rust's memory semantics would just be the best of everything.
As for optional GC, didn't D haven't something along those lines?
Re: A Quick Comparison of Nim vs. Rust
#9Are you just using --opt:speed to compile the Nim examples? For maximum performance you should be using -d:release.
Re: A Quick Comparison of Nim vs. Rust
#10Earlier quoted context omitted.
-d:release disables bounds checking, so the Rust examples would have to be modified for unchecked indexing for a fair comparison.
It disables a lot of other things too. The current comparison is unfair. Why do the examples need to be modified to disable bounds checking for Rust? If it's easier you can compile the Nim examples with -d:release and enable bounds checking by also supplying --boundChecks:on.