Lombardi Trophy, the trophy awarded to the winner of the National Football League's Super Bowl, in front of flames.

JavaScript Won

Let me tell you a story about the time I almost quit Rust… again… and why I can’t really recommend everyone go and use it.

I’ve heard some folks dismiss Rust as a systems programming language. Even if it was ever “just” that, I don’t think it’s just that anymore. Rust can do most things now, which is more to say the Rust ecosystem provides support for doing work in a lot of different domains (since as a Turing complete language, it, by definition, could do all the things), and with recent efforts like Polars it will continue to encroach on other domains. The problem I see is… well… you’ll like it the most if you’re a systems programming kind of person. I’m not saying if you’re happy writing for the Linux kernel with C, you’re going to love Rust, but I am saying if you love Rust, you might be the kind of person who would have also been happy writing C for the Linux kernel.

I’m kidding. Rust just makes everything feel harder to me. Everything takes a little more effort than some alternatives I’ve used in the past. Sure, some of that is I’m still a relative neophyte. But listen, I got over the hump. I am definitely not saying I’ve become a competent Rust developer, yet. What I can say is I am now making good progress after hitting a bit of a wall. Once I started making that progress, there was a nagging feeling in the back of my head. What was that? Why would I be bothered now I was making progress? Well… it still feels harder. When picking up other languages, I’ve felt things ease up significantly after getting over that hump.

Okay, so why am I still continuing with Rust? That performance! I came across this excellent article from Hackaday, referencing this data. (There’s also some newer data there.) So, Rust is second for Energy & Time only to C, and it’s in the second tier for Energy & Time & Memory. And check these cold starts updated daily. (I heard about this one from a recent episode of Ship It!.)

(Yes, yes, benchmarks are a loser’s game. Yes, I know you’ve seen other benchmarks where X beats Y, and there are circumstances where Z is amazing and A is trash.)

This one dataset was enough to get me to seriously consider Rust for all things. It’s funny because I can’t say the same about C. (Peace! It’s easy for me to say why. Here’s an article referencing a comment by a Microsoft engineer indicating 70 percent of vulnerabilities in Microsoft products addressed through security updates each year were memory safety issues. Rust can help avoid that.)

I should come clean (pun intended). Earlier I said it was the performance. That’s not entirely true. I’ve written production code in languages further down the list referenced above. There have been remarkably few instances wherein I couldn’t eek out “enough” performance. So, that’s not really enough for me. Simply, I worry about the environment. There is more code running today than ever in history (I think). So, if I can do my part to decrease the environmental cost of running those systems, I feel compelled to try.

I know a lot of folks in the Rust community take exception to the idea performance would be the main reason to select Rust. That’s it; I just wanted to acknowledge that.

That’s cool and all, but why’s the title JavaScript Won? Well… it has.

First, you should really be using TypeScript if you’re going to be using the JavaScript ecosystem. Whew, glad I got that out of the way.

[…] aliens visit in thousands of years, and humans are long gone, something tells me that most of the systems they find will be running JavaScript. — Lex Fridman

I’ve referenced this quote and video previously. JavaScript has won. I have to admit it. I don’t have to like it, but maybe I should learn to like it.

To be fair, I also preferred Mercurial over Git. So, what do I know? Today, I use Git all the time. It’s not just okay, it’s really good, and I can just choose to not do the parts I dislike (or conform to my team’s practices like a good teammate).

Rebasing is evil on a sign hanging from a table with a man sitting at the table drinking from a mug, popular meme.

So, I can get over myself. I’m comfortable being wrong. I’ve often been wrong in the past. If you’re not often wrong, you’re playing it too safe. So, I’ve been wrong about JavaScript.

I really hoped Rust was the answer, but my biggest problem is I don’t currently feel it’s optimized for developer productivity. In this video, ThePrimeagen talks about how much faster it was to write his sample app in Go, even though he had the least familiarity with it as a language. Maybe you’ll say he’s not that good at Rust, he even says, ”[…] whereas Rust, I obviously am not that good at writing it.” To that I wager he’s a better Rust developer than most folks you’re going to randomly run into. Or maybe you’re thinking to yourself, you can be better than he is. Maybe you can be, but that brings me to my next point.

I’m in the camp convinced the reason Rust has been at the top of Stack Overflow’s survey is because no one’s being paid to do it. So, if you’re doing it alone for some side projects, knock yourself out. Maybe you’ll be a Rust rock star.

There are only two kinds of languages: the ones people complain about and the ones nobody uses. — Bjarne Stroustrup

Know which language is highest on the list and sees, anecdotally, high usage in industry? Yep, TypeScript.

Since I brought ThePrimeagen’s video into this, I do want to acknowledge his TypeScript implementation failed to live up to the performance of the Go or Rust implementations. 100%, I get it. So, if you’re actually performance capped, great, pick something to get the job done, but like I said, I’ve very rarely run into that in my professional life. Plus, based on his experience, Go will get you there with less friction.

I think “you” should probably use TypeScript, unless you have a specific, and unimagined, reason to use something else. I can’t yet, in good conscience, advise the wholesale adoption of Rust. Heck, maybe I’ll write a post some time about why I’d still recommend a lot of enterprises use Java (or Kotlin).

Sorry, I should clarify. I like having a default programming language, the language I reach for whenever I have a random project. So, if something makes more sense to a specific context, just use it, be pragmatic. For example, doing data science or ML work? Just use Python. Front end? TypeScript. Cloud infrastructure? Go. Nothing in particular, just use TypeScript and get on with solving the actual problem.

And after all of that, what am I going to do? Well… I’m going to keep struggling my way through learning Rust. It’s the best I have for now. I’ll continue to watch for the next new programming language to take the world by storm. Who knows, maybe Andrej Karpathy was right about English being the way ahead. Or… maybe… I’ll be a Rust rock star.

Kiss band in full costume and makeup