index.png

Why is esbuild fast?

Several reasons:

Each one of these factors is only a somewhat significant speedup, but together they can result in a bundler that is multiple orders of magnitude faster than other bundlers commonly in use today.

Benchmark details

Here are the details about each benchmark:

This benchmark approximates a large JavaScript codebase by duplicating the three.js library 10 times and building a single bundle from scratch, without any caches. The benchmark can be run with make bench-three in the esbuild repo.

Untitled

Each time reported is the best of three runs. I'm running esbuild with --bundle --minify --sourcemap (the single-threaded version uses GOMAXPROCS=1). I used the rollup-plugin-terser plugin because Rollup itself doesn't support minification. Webpack uses --mode=production --devtool=sourcemap. Parcel uses the default options. Absolute speed is based on the total line count including comments and blank lines, which is currently 547,441. The tests were done on a 6-core 2019 MacBook Pro with 16gb of RAM.

Caveats:

This benchmark uses the Rome build tool to approximate a large TypeScript codebase. All code must be combined into a single minified bundle with source maps and the resulting bundle must work correctly. The benchmark can be run with make bench-rome in the esbuild repo.

Untitled

Each time reported is the best of three runs. I'm running esbuild with --bundle --minify --sourcemap --platform=node (the single-threaded version uses GOMAXPROCS=1). Webpack uses ts-loader with transpileOnly: true and --mode=production --devtool=sourcemap. Parcel 1 uses --target node --bundle-node-modules. Parcel 2 uses "engines": "node" in package.json and needs the @parcel/transformer-typescript-tsc transformer to be able to handle the TypeScript code used in the benchmark. Absolute speed is based on the total line count including comments and blank lines, which is currently 131,836. The tests were done on a 6-core 2019 MacBook Pro with 16gb of RAM.

The results don't include Rollup because I couldn't get it to work. I tried rollup-plugin-typescript, @rollup/plugin-typescript, and @rollup/plugin-sucrase and they all didn't work for different reasons relating to TypeScript compilation.

Upcoming roadmap