In the weeks after the new Apple Silicon Macs were launched there were plenty of reviews with benchmarks for tasks like video encoding, 3D rendering and so on. However I couldn't find anything testing the web development tools that I use every day, such as Node, Babel and TypeScript. A lot of the M1's speed comes from specialised cores, so there was a risk that it would not be as fast for web development. In the end I decided to risk it and order one and run some benchmarks myself.
I'd been looking for something to use as a headless compilation machine for a while. I'm an engineer on the Gatsby open source team, and have to compile the massive monorepo many times a day. We do a lot of a pair programming over Zoom, and that's particularly difficult when compiling. VS Code remote development is very slick, so when the M1 Macs were released, a Mac mini seemed just the job. I needn't have worried: the Mac mini M1 comfortably beats my Macbook Pro in every task I threw at it. This includes benchmarks, but also real world development tasks.
Test setup
I ordered the entry level Mac mini with 8GB of RAM, and my comparisons are with my work machine: a Late 2019 16" Macbook Pro 2.3GHz core i9 with 16GB of RAM. For my initial tests I used the V8 Web Tooling Benchmark. This uses Node to run several realistic tasks, using the sort of tools web developers use every day: Babel transpilation, and various other parsers, TypeScript, PostCSS, Prettier, ESLint and more. The benchmark itself is three years old, and uses old versions of these tools. It can run on the latest Node though, and should still be representative of the relative speeds.
To run the tests, I first installed Node 15.4.0 using Homebrew on the mini and using nvm on the MBP. I made sure that it was running natively by using the Node REPL to check process.arch
. It will be arch64
if it's a native build, and x64
if running the Intel version using Rosetta2. I ran the benchmarks according to the instructions: npm install
, npm build
then node dist/cli.js
. I ran the benchmarks several times to be sure they weren't outliers.
Results
V8 Web Tooling Benchmark. Higher scores are better
Mac mini M1
Running Web Tooling Benchmark v0.5.3…
-------------------------------------
acorn: 21.29 runs/s
babel: 14.64 runs/s
babel-minify: 20.82 runs/s
babylon: 21.11 runs/s
buble: 10.25 runs/s
chai: 27.62 runs/s
coffeescript: 14.24 runs/s
espree: 4.07 runs/s
esprima: 15.86 runs/s
jshint: 18.65 runs/s
lebab: 18.26 runs/s
postcss: 10.97 runs/s
prepack: 15.17 runs/s
prettier: 11.85 runs/s
source-map: 16.93 runs/s
terser: 35.89 runs/s
typescript: 17.13 runs/s
uglify-js: 11.56 runs/s
-------------------------------------
Geometric mean: 15.57 runs/s
2019 Macbook Pro 2.3GHz core i9
Running Web Tooling Benchmark v0.5.3…
-------------------------------------
acorn: 9.80 runs/s
babel: 9.04 runs/s
babel-minify: 12.95 runs/s
babylon: 12.37 runs/s
buble: 6.21 runs/s
chai: 18.01 runs/s
coffeescript: 9.25 runs/s
espree: 4.32 runs/s
esprima: 10.14 runs/s
jshint: 12.10 runs/s
lebab: 13.86 runs/s
postcss: 8.55 runs/s
prepack: 9.06 runs/s
prettier: 8.69 runs/s
source-map: 11.68 runs/s
terser: 20.48 runs/s
typescript: 10.34 runs/s
uglify-js: 6.61 runs/s
-------------------------------------
Geometric mean: 10.10 runs/s
The Mac mini M1 is consistently around 50% faster than the Macbook Pro in the Web Tooling Benchmark.
These are native speeds, with an arm64 build of Node. However neither Node.js nor Homebrew offically support Apple Silicon yet, and many native npm packages need to compile from source. There are many cases where you may need to run x64 tools using Rosetta2. This is inevitably going to be slower than native, but the good news is that it's still faster than the Macbook Pro.
Mac mini M1, via Rosetta2
Running Web Tooling Benchmark v0.5.3…
-------------------------------------
acorn: 15.34 runs/s
babel: 11.84 runs/s
babel-minify: 15.46 runs/s
babylon: 14.56 runs/s
buble: 7.93 runs/s
chai: 22.66 runs/s
coffeescript: 11.60 runs/s
espree: 5.51 runs/s
esprima: 14.44 runs/s
jshint: 15.92 runs/s
lebab: 15.15 runs/s
postcss: 10.44 runs/s
prepack: 12.23 runs/s
prettier: 9.76 runs/s
source-map: 16.78 runs/s
terser: 24.10 runs/s
typescript: 10.36 runs/s
uglify-js: 7.94 runs/s
-------------------------------------
Geometric mean: 12.64 runs/s
Even via Rosetta the Mac mini is around 25% faster than the Macbook Pro.
Real-world tests
While the benchmark seems to be representative of real-world web development tasks, I still needed to compare with my day-to-day tasks. If anything, the lead is even more there.
Running lerna bootstrap
in a clean gatsby monorepo. This runs yarn install
in the root of the monorepo, then yarn install
across all 112 packages, and then yarn prepare
which builds each of them and prepares it for publishing. Most packages are compiled with Babel, but some are compiled with the TypeScript compiler, and some of the Babel ones have TypeScript types generated. Some packages are bundled with microbundle or rollup. There's even a Gatsby site in there (the gatsby-admin app). It's a generally tough but representative sample. Lower times are obviously better!
- Macbook Pro: 4 mins, 33 seconds
- Mac mini M1: 2 mins, 45 seconds
This was run simultaneously on both machines (using iTerm input broadcasting), with both on the same network.
One thing I noticed while running it was that the yarn install was noticably faster on the mini, which I put down to faster disk IO. To see the other side of disk IO that most web developers need to do, I checked this by running rm -rf node_modules
!
I tried several other tasks, such as running the gatsby-dev-cli
which publishes all gatsby packages to a local npm server, and then installs those in a site for testing. Each of them was considerably faster with the Mac mini.
Conclusion
As I'm using mine as a remote compilation machine I haven't run tests on other apps, but there are plenty of other reviews that have. Based on my tests, the M1 Macs are incredibly fast for web development, and are an absolute bargain too. This was a bottom of the range Mac mini comfortably beating a top of the range Macbook Pro that's just a year old and cost four times as much.
Top comments (6)
Yes! These are the benchmarks I've been waiting for! (a webpack benchmark would be nice as well, as waiting on webpack-dev-server to compile is really my bottleneck these days.)
I thought I'd contribute my benchmark results as well. Interestingly, despite being a 2.9GHz core i9, it fares a tad worse than your 2.3GHz core i9, I guess because it's from 2018 instead of 2019.
hardware:
MacBook Pro (15-inch, 2018)
2.9 GHz 6-Core Intel Core i9
32 GB 2400 MHz DDR4
node version:
Using node 15.4.0 installed via
nvm
.3 consecutive runs:
Sadly, I can't use a Mac Mini as my main development box, because going from 32GB of RAM to 8GB would probably undo the core speed improvements. (With Webpack, Docker, Chrome, Iterm2, and VSCode all running, I easily eat up 20GB of RAM just spinning up my work website. 27GB if I run FF and Jest as well.)
Now, if they made a Mac Mini Pro with 32GB of RAM... that would probably be perfect!
If you look at the current 2020 macbook pro 16” offerings you’ll see that the 2.3ghz build is more expensive than the 2.6ghx. This is because this is the base speed that all cores sustain. The 8-core can sustain a lower frequency but there are more cores. However if not all cores are needed the boost speed is up to 4.8.
Your 2018 intel processor probably is a 6-core, so it has higher base frequencies but fewer cores, but likely can only sustain lower frequencies for the same amount of cores when compared to the 2019 2.3ghz.
I also did some benchmark using webpack and my node stack against a 64gb ram 2.3ghz i9 macbook (2019) and the M1 macbook was on par or faster. Node was compiled natively for darwin arm.
Both machines were from the same time machine restore, and to simulate a normal environment I had safari with about 30 tabs, VS Code, and a mongodb instance running in both.
Also as a bonus Safari loads up about 5+ seconds slower on the 64gb ram macbook 16”.
I believe the way the M1 works means memory usage will work differently too. I wouldn’t go so far as to assume you would need 32gb to maintain any performance advantages... certainly doesn’t help the 16” here.
I installed the latest LTS. I didn't use brew to install it though, I built my own binary via nvm. This is on a Mac-Mini 16GB. Built with xcode command line tools 12.3.
Which processor is that?
Amazing! The next M chip is going to pulverize intel even more
Seems that it should be
yarn run bootstrap
according to gatsbyjs.com/contributing/setting-..., notlerna bootstrap