Wow, the #rust community really is amazing! I posted a fairly beginner question on r/rust just now, and within 10 minutes I got 8 comments—7 of them were attempted solutions, 6 of them were *correct* solutions, and 2 of them had full, running code samples/diffs.
And *none* of them called me dumb or implied I don't know how to program—even though I made a classic beginner mistake (solving ownership issues with excessive use of `clone()` instead of by understating my code better)
@codesections genuinely considering going rust just to be treated be like human when programming I'm happy for you!
@codesections It's a good thing that some programming communities are treating beginners with respect.
@codesections again, some improvements to your (new version of) code: https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=e4e9953cc7919d0d9a44e809ffa264e2 (notes inline)
On my machine it is about 10% faster than your version, must be because it doesn't do the conversions between usize/i32/Option<i32> everywhere.
And again the Rust and JS versions are doing a similar number of allocations, that is why the performance is similar.
Thanks! I took your changes and ran with them—new code here: https://gist.github.com/codesections/9959d4ddaf23be19078802754482874d.
@codesections What? Not even a "RTFMP"?
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.