Hi everyone,

I recently discovered Nim and I've been pretty excited by what I've seen of the 
language so far. I've seen that Nim can get excellent performance on some 
benchmarks, but I wanted to test its speed myself. I've written a simple 
benchmark program in a few languages. My program calculates the number of pairs 
of intersecting polygons in a given list. I have deliberately chosen a naive 
approach and avoided doing any low-level optimizations. I've written the 
program with nearly identical structure in a few languages, and I was 
disappointed to see the Nim version dramatically outperformed by the Rust 
version. On my machine, my Rust implementation generally runs the calculation 
in about 75 ms, while the Nim version takes about 300ms. The Nim version is 
actually significantly slower than a version I wrote in Kotlin, which I found 
rather surprising. Is there anything obvious that I'm doing wrong? I am 
building the executable using `nim c -d:release geometry`. My machine is 
running Windows 10 on an Intel i5 processor.

Source for my program: 
<https://github.com/alexpardes/benchmarks/blob/master/nim/geometry.nim>

Thanks

Reply via email to