DEV Community

Yufan Lou
Yufan Lou

Posted on

Don't forget your --release flag when benchmarking

Saw this very old post comparing k-NN algorithm implemented in different languages, and for the love of my life I can't believe Rust runs the thing in over 1 minute.

So I took the code referred to in the post and ran it. Well it ran in over 40 seconds. I puzzled for an hour, even trying to implement the Go style code in Rust.

Then I realized I forgot the --release flag. I append it. It runs in not even a second.

How I got distracted by this when I was on that old blog for Hindley-Milner is another question.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay