Skip to navigation Skip to main content
Stable
3.0.0
Canary
3.0.1-alpha.5
Toggle Menu
Eleventy 5.81s
Gatsby 43.36s

Performance

INFO:
You’ll probably want to read the Debug mode documentation before continuing here.

Eleventy by default will warn you if certain pieces of your build take longer than 8% of your total build time. This list includes:

This list is not considered to be exhaustive. It’s just what has been implemented thus far!

Show All Performance Measurements

You can use the following debug command to show performance measurements for all of these entries (not just those that take longer than 8%).

Learn more about environment variables for debug output.

macOS or Linux (et al)

DEBUG=Eleventy:Benchmark* npx @11ty/eleventy

Windows

set DEBUG=Eleventy:Benchmark* & npx @11ty/eleventy

Aggregate Benchmarks

We also have a special category of aggregate benchmarks to do higher level analysis. Look for entries like:

Benchmark (Aggregate): Searching the file system took 40ms (0.5%, called 2×, 19.9ms each) +0ms
Benchmark (Aggregate): Data File took 134ms (1.8%, called 405×, 0.3ms each) +0ms
Benchmark (Aggregate): Template Read took 682ms (9.0%, called 600×, 1.1ms each) +0ms
Benchmark (Aggregate): Passthrough Copy File took 924ms (12.2%, called 669×, 1.4ms each) +0ms
Benchmark (Aggregate): Template Compile took 366ms (4.8%, called 1526×, 0.2ms each) +0ms
Benchmark (Aggregate): Template Render took 1215ms (16.1%, called 949×, 1.3ms each) +0ms
Benchmark (Aggregate): Template Write took 2088ms (27.6%, called 312×, 6.7ms each) +0ms

Note that while we do make every attempt to make these as accurate as possible, the percentages for these entries may be greater than 100% due to the asynchronous nature of these tasks (passthrough copy especially).

Node.js Profiling

The most reliable mechanism for tracking down performance issues in any Node.js based code is to use Node’s built-in CPU Profiling feature (Node v12+). You can run Node with the --cpu-prof argument and point to the Eleventy bin like so (noting that --quiet is an Eleventy CLI argument and you can add any others there too):

# Instead of:
# npx @11ty/eleventy --quiet

# Use this:
node --cpu-prof ./node_modules/.bin/eleventy --quiet

This will write a CPU.***.cpuprofile file to the same directory.

SpeedScope is a great web site that will help you look at a visual representation of this data, with a special nod to the Left Heavy and Sandwich visuals!