Rust notes

Starting a thread on Rust notes …

Compiler performance is important – glad they are watching it!

from: Exploring Deno Land 🦕 with Ryan Dahl (The Changelog #443) |> Changelog

(talking about Deno) The first important aspect is that it’s written in Rust instead of C++. Node is a very large C++ project, and I’m not sure how you guys feel about this, but I’m very convinced that I will never start another C++ project. Rust really solves the C++ problem, as it were. There’s many great things about Rust, but the thing that is most important to me is the ability to have a single build system; this cargo system of linking together different Rust crates. In C++ there’s no one defined way of how to take different C++ libraries and smash them together. Chrome has this GN project, Node uses this Gyp project, there’s CMake… There’s a lot of different tooling for compiling together dependencies in C++. And this ends up being a huge, huge complexity in terms of bringing in external third-party code into a big project.

In Node days, we built a web server and you’d have to parse HTTP, and it’s such a difficult problem that we ended up writing our own HTTP parser for this. It’s so difficult to bring in external code that you end up often having to just write the stuff over again, because it’s so difficult to link. And this is very different in Rust. If I need a YAML parser, if I need an HTTP server, any sort of third-party stuff, I would do what people are used to doing in JavaScript, or Ruby, or Python - you can just kind of include dependencies and have this all compile together really nicely. And that’s an important aspect for a platform like Deno or Node, because we provide all of these APIs to do various things. You wanna open a WebSocket, you wanna have an HTTP/2 web server - all these various systems that it talks to need implementations… And it’s very nice that we’re able to just link in third-party implementations of all these various systems pretty easily. So from a maintainer’s perspective, rewriting it in Rust is a really killer feature that kind of allows us to iterate much quicker.

analyst firm SlashData stated that Rust has

nearly tripled in size in the past 24 months, from just 0.6M developers in Q1 2020 to 2.2M in Q1 2022.