Check out a free preview of the full Blazingly Fast JavaScript course

The "Requirements" Lesson is part of the full, Blazingly Fast JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen provides instructions for installing Rust, Golang, and the required versions of Node.js. The optimizations will be available in different branches, allowing students to follow along even if they encounter difficulties.

Preview
Close

Transcript from the "Requirements" Lesson

[00:00:00]
>> So you are gonna need Rust, you're gonna need Golang because I can't help but to throw every language I can possibly use into any project. So installing Rust is incredibly simple, you Google install Rustlang it's gonna take you to a shell script. You're gonna take that copy it, probably give it pseudo privileges because you know scripts from the internet should always just be installed at freewill, and there you go.

[00:00:21]
And then same thing with Golang. You literally, Google install Golang, and you'll be able to install Golang. Make sure you're at least at version 1.2.1 or higher, very important, okay? Rust has been mentioned. We haven't mentioned HTMX yet, but we're doing pretty good. Please at least get the latest version of Node or something pretty late, just 20 something that's good enough.

[00:00:42]
Just be in the 20s because each node version will have vastly different experiences. One thing I was kind of doing at work is I had to iterate over very large sections of data for my job, and it was in node. And when I used node 18 versus node 20, there was like a several seconds difference for using for each as opposed to a for loop going over millions of rows of data.

[00:01:04]
And so can things be different between versions of node? Absolutely. So we're gonna all try to be on the same-ish version, at least hopefully the mostly the same, I don't know the last time I've updated my node 20, but it was probably a month ago so be close enough.

[00:01:18]
And then lastly here's really the only thing you're gonna really wanna copy and pasta from this, there'll be probably one or two other ones, which is all of this right here. That's really the only thing you're gonna wanna have on your system. You're gonna just wanna clone this out however you want and wherever you want.

[00:01:34]
So I'll do literally the exact same thing. I'm gonna take all of that information and I'm just gonna clone it out. It's gonna build some Rust that takes a long time. My fan might start spinning here shortly. There it goes. We're building. You can tell we're doing something.

[00:01:55]
Did you guys hear that Rust recently was adopted fully by Microsoft?
>> Not fully.
>> Yeah, they're like really going all in on it. They've decided to really invest millions of dollars, hire many Rust engineers. It's official. The amount of Rust jobs have doubled in 2023. We're up to well over 21 positions.

[00:02:12]
Not more than 23, but it's really starting to happen. It's happening right now. So I'm gonna give everybody a few moments to be able to get Rust installed, to be able to get Golang installed, node version on the latest. There's a couple things he got to do, so make sure it all happens.

[00:02:30]
And then, of course, you want it all built and everything. And if you use Neovim, obviously bonus points, it does make your project 20% faster just using Neovim. Vim is only like 10% vast or so. Sorry, yes?
>> Is today's course gonna be mainly focused on Node?
>> Well, we'll be using Node as our running platform and running everything off of.

[00:02:54]
We won't be running in the browser, and we won't be running Bun. Bun is obviously much different. The tools aren't as much mature. Maybe in a year could do something fun with going over all the Bun tools and all that. The goal of today's course is to use the tools that are easily available in Chrome to be able to identify bottlenecks and be able to try to make good performance changes in your code base.

[00:03:17]
Because obviously there's better and more in-depth tools being one of the most in-depth tools possible, but it's not as easy to set up, right? Right now, I have to run perf through a Docker container because I can't currently even get it to work on just my OS. So I'm running things through an entire roundabout way to get something to run.

[00:03:35]
So it's not always just the easiest to use, and so I didn't really wanna include anything that's gonna have a lot of setup time, and which is gonna cause people to kind of fall off and not be able to follow along. So there you go, yeah?
>> What level of JavaScript are you gonna need to know in order to do this course?

[00:03:55]
>> All right, so what level of JavaScript are you gonna need to know to do this course? Just basic proficiency. That's all you really, if you understand how functions and classes work, you know how you can pass them around, you can just use them normally, then yes, that's enough.

[00:04:10]
Like, I'm not gonna expect you to know every single array method. We're not gonna be going over meticulously. Again, I don't like those kinds of optimizations, like don't use push, use X. It's like, yeah, that only makes sense when there's a real problem with it. And that's usually not because of the function, that's because of what the function is doing.

[00:04:29]
And so push versus setting length by minus one, that's not, you're doing the same operation just differently. You're not changing the problem. You're just changing how you're invoking the problem. So, if that makes sense. You don't need a ton of JavaScript, but you should be pretty good at it.

[00:04:44]
You should be comfortable writing JavaScript. All right, so two quick things. It's not really two quick things. It'll be about seven quick things. We're gonna be doing optimization step by step and independently for the first couple, and then we're gonna kind of figure out where the value is, what's going on with each change.

[00:04:59]
We're also gonna be using local host to test. Local host has its obvious problems with it. It's never gonna quite look like the real world. Your operating system does things that are gonna probably be very different than if you're getting Internet packets versus from yourself packets. It can still be used to do some testing, but it's not gonna quite be the real world.

[00:05:19]
Obviously, whenever you're doing any, you know, performance optimizations, though, it should be bared out in the real world. You should be able to measure this. You should be able to understand it, whatever way you collect data, and understand how fast your endpoints are going. You should see real impacts because if you only see it locally, but you don't see in production, it just means you didn't really make any change.

[00:05:37]
That's worthwhile. It doesn't mean that change won't be worthwhile at some point, it just may not be worthwhile at the time, just due to how it works locally versus in production. And second off, we're gonna all get different results. We're all running on different computers. I will get different results than I did yesterday running these things.

[00:06:00]
And so, I tried not to put any hard numbers in this presentation, because depends on how many programs I'm gonna be running. I wasn't planning on running this website locally, well, I'm currently running it locally. So, I don't know what that does to performance. I don't know what that does.

[00:06:20]
I also have a LSP running right now, or two, or three or four LSPs running, so I have no idea how that's gonna affect measuring performance. So in general, measuring locally has that effect as well as you're not on an isolated system. You're not on a system that's just doing one thing.

[00:06:34]
You're on a system that's doing, who knows amount of items. So you can't, it's very hard to reproduce the same thing twice. But it's very obvious when you've made a substantial improvement in the direction, because even though the numbers may vary, the results keep showing some same proportional movement.

[00:06:49]
So just some things to think about. I also have two three monitors. I never have three monitors. I have this one, this one and this one over here, and I don't ever have 4k going. So how does that affect it? I have no idea. And again, no micro benchmarks.

[00:07:01]
We already talked about this ridiculous, all right? I'm also not very good at planning. So every single step of the way, every single change we're gonna make all the optimizations will be available in branches first off, second off and third off. So you'll be able to kind of follow along, so if you can't quite get one to work locally, can't get the test to pass, you can just jump into the next branch and continue on with us.

[00:07:24]
So that way, you don't get left behind at all. I don't think the programming is honestly as important as just going over the topics, going through the motions and doing these, and going through like the reasoning of why we're gonna do something. Cuz at the end of the day, I'm sure all of you are great programmers or good enough, and you will be able to do these changes by yourself.

[00:07:45]
It's really the reasoning that's more important. So if you fall behind, that's okay. Jump on another branch. It's okay.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now