News for hackers. Stuff that matters.
Re:Performance Showdown: Rust vs Javascript (2020) by jkelleyrtp on Friday February 12, 2021 @10:11AM (#26114451)
People seem to love coming into the Rust community and then saying - hey, I did this micro benchmark after just learning rust - and XYZ language is faster!

Anyone who's been writing rust for a little bit will notice the String clone like a sore thumb. The "go-to-perf-guide" also very explicitly states than clones on String/Vec/Box etc will cause an allocation and slow down your code.

https://gist.github.com/jFransham/369a86eff00e5f280ed2512145...

In every one of these micro benchmarks, the comments will then show that by removing the alloc, the Rust version ends up much much faster.

String cloning is one of those things you learn to avoid early on, and any time you type "clone" it should be obvious that there's a better way to write your algorithm.

There are no comments on this comment yet.