Note: This is an update to my recent post, How to make VS Code load faster with a little bit of housekeeping.
I was pretty happy with the startup speed I gained by removing a few extensions, but VS Code still took a while to load.
Yesterday I stumbled on something that let me load VS Code 775% faster than before on my Mac laptop. Seriously. On a cold boot of VS Code, my load time went from 15 seconds to just about 2 seconds. So, how did I do it? Let's cut to the chase:
If you are running Visual Studio Code on a Mac with an Apple Silicon processor (also known as an M1, M1 Pro, or M1 Max), you will get a massive performance boost by installing an Apple Silicon optimized build of VS Code.
This is because previous builds weren't natively compatible with Apple Silicon, and ran Intel code through a virtualization process that apple calls Rosetta.
The fix: Download the latest version of VS Code for Mac, install it. If you were previously running an Intel build, this is all you need to do. That's it!
In 2019, Apple released their first round of computers that run on their own processors, which they call Apple Silicon. These chips are fundamentally different from the Intel processors that Apple was using on all of their computers until recently. Apple found massive performance benefits from their migration to a new chipset, but running software on the new processor architecture requires app developers to recompile their software for the new chips.
Thankfully, engineers at Apple were smart enough to know that asking every Mac app developer in the world to recompile their apps for Apple Silicon will take a very long time. To hedge against this, they built a recompilation layer into MacOS called Rosetta, which allows Intel apps to run on the new chips. Because there's essentially a thin VM layer running these apps, they are slower and less energy efficient than apps compiled specifically for Apple Silicon.
That's exactly the gain we're finding here by updating VS Code. There wasn't an Apple Silicon build available until September of 2020, due to VS Code's dependency on Electron to run.
If this quick fix helps you and you're like me, you likely installed Code long before September of 2020. Your install of Code would get regular updates, but you were getting Intel builds of the app. Switching to a more recently downloaded version of the app will automatically install an Apple Silicon build, and just like that, you're sorted! 🧙♂️
In the process of figuring all of this out, I discovered that you can actually see which apps on your machine are running Intel builds vs Apple Silicon Builds.
To check any given app, follow these steps:
- Open Activity Monitor (hit command + Space, and type in "Activity monitor")
- Right click on one of the headings at the top of the table of running processes, to see a list of possible columns for the table.
- Make sure the option called Kind is checked
- You'll now see a column labeled "Kind", which will say "Apple" or "Intel"
If you're running an Intel version of VS Code, you'll see something like this:
If that's the case, I have great news! You're probably going to see a massive speed boost. This is a good time to close VS Code and time how long it takes to start fresh. On my M1 Macbook Air with 16GB of ram, it took about 15s.
Now, go Download the latest version of VS Code for Mac and install it on your computer (Choose to "Replace" the old install if prompted).
When that's done, you should see this the next time you load VS Code:
How was that load time now? For me, it was down to about 2 seconds! It's not every day you get those kind of gains.
- How to make VS Code load faster with a little bit of housekeeping, my previous post on speeding up VS Code
I reclaimed 10GB of disk space from
gitignore.io is great for a tip on a super helpful tool for setting up
.gitignorefiles on new projects.