The article makes the case that we may not really need to re-write all these things to Rust, and I heartily agree! I will add that a thing learning a bit of Rust really did for me was build my intuition a lot more about what might be slow or expensive in JS land. Meaning, while rewriting in Rust might be justifiable on various other grounds, merely borrowing knowledge gained from learning Rust has potential to improve your millage in a non Rust code base quite a bit.
For example, In the article a few times he says something like this a few times, “The
rule.toString() call caught my eye pretty quickly. Places where one type is cast to another are usually worth another look if you’re tackling performance as not having to do the conversion always saves time.” Well, someone without experience in a language like Rust, one that FORCES you to understand and deal with the complexity of strings, or the cost of type conversions and the new memory pointers that are involved, may not have this sort of intuition. I certainly didn’t! Or I only had vague impressions, versus a more grounded instinct.
One recurring theme in this training workshop I recently attended was Rust makes you have to “deal with it!”, and though that can be a difficult adjustment for some, ultimately it is a very potent practice. This workshop deals with asynchronous code in Rust, which wasn’t something Rust really supported when I first learned it, but now does, and seeing how Rust’s approach stands to improve stability and performance was a new layer of eye opening for me. And also, again, something I don’t remember him saying that I would add is that ultimately getting your head around this approach is good for you outside of Rust too!
- Understanding the way memory gets used, freed, or passed; Memory in garbage collected languages is still managed, just not by you and not by the compiler.
- Being exposed to the underlying complexity of “strings” Rust book on strings
- Being forced to actually deal with optional return values will make you grok some of the pitfalls of null/undefined, etc.
Of course, on the other hand, once you internalize some of those ideas Rust brings to light you might feel less and less comfortable with all the foot guns other languages leave laying all over the damn place.
I first started learning a bit of Rust a few years ago as a sort of new years resolution, and I feel like that paid off well for me, even though at the time there wasn’t a lot of opportunity to do web type development with it. The landscape has changed quite a bit More webby tools, so re-committing to expand on my Rust skills in 2023 seems like it might have some similar benefits.
Note: a fun term for rewriting in Rust is “oxidizing”. Here is a short list of CLI tools that have been oxidized https://zaiste.net/posts/shell-commands-rust/
Other Rust projects I am keeping my eye on:
The Google Android team has reported some really significant success using Rust, and now as a whole training course available https://google.github.io/comprehensive-rust/welcome.html – social media commentary on this