News for hackers. Stuff that matters.
Re:How to write slow Rust code by pizza234 on Monday August 02, 2021 @11:16AM (#28037669)
I'm confused at why the author is using static mutable variables, which, while sometimes required in Rust, they are at a high risk of design issues.

In addition to the design issues, they are also implemented via mutexes, which have overhead - and I don't see threads in the file.

EDIT: Even more skeptical. By replacing the ONE/TEN pseudo-static variables with standand/idiomatic local variables (and borrowing them), I get a 10% increase in performance.

Re:How to write slow Rust code by mst on Monday August 02, 2021 @01:48PM (#28040084)
Um, the article mentions that somebody explained to him that was wrong, and he replaced them with something better.

This whole article is about "here's a bunch of things I got wrong because I'm not very good at rust and people were kind enough to help me fix them and I'm going to show you the fixes", I'm not sure what there is to be skeptical about here?

Re:How to write slow Rust code by pizza234 on Tuesday August 03, 2021 @01:23PM (#28051769)
I don't see much (if any) value in this article.

The code was very unidiomatic to start with, and the issues are not just a matter of style - they're very substantial, and the code is still unidiomatic.

At least one of the conclusions through the article is wrong - the author uses a vector of String references, concluding that the logic can't be easily simplified (because lifetimes are required). This data type is wrong, as owned String's should be used, which don't require any maintenance.

This wrong conclusion has actually the side effect of describing a language complexity that doesn't exist (I'm certainly not arguing that Rust is complex, but credit should be due to cases where such complexity doesn't apply).

Reconnecting to the beginning, I'm not sure what the value is supposed to be. Benchmark unidiomatically implemented updated to still unidiomatic implementation and flawed algorithm, with at least one improper conclusion, gives results that are not meaningful?