Gatsby Incremental Builds on Netlify?

I would like to share my test results with Gatsby Incremental Builds on Netlify and initiate a controversial(?) discussion.

My conclusion: Netlify does not (yet?) provides incremental build support - all speedups are due to the caching effects provided by netlify-plugin-gatsby-cache.

Prerequisites

Let’s jump right into the details. Before starting the tests, I had to switch from yarn to npm as described here. In all tests, I made sure that netlify-plugin-gatsby-cache is installed. I split tests in two parts (1) normal build with gatsby build, (2) experimental page build with GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages.

Starter Project

Test results are based on gatsby-starter-try-ghost which provides incremental build support for Gatsby Cloud. This starter creates a Gatsby demo site with content coming from a headless Ghost CMS. Here are the results:

Results

  1. Build command: gatsby build
Description init build post total (min)
Initial build (new cache) 1:35 1:25 0:13 3:13
Trigger panel (keep cache) 0:33 0:35 0:04 1:12
Tigger Webhook 0:27 0:30 0:03 1:00
CMS content edit (1 Page) 0:28 0:30 0:05 1:03
  1. Build command: GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
Description init build post total (min)
Initial build (new cache) 1:35 1:25 0:06 2:56
Trigger panel (keep cache) 0:26 0:26 0:03 0:55
Tigger Webhook 0:35 0:35 0:03 1:13
CMS content edit (1 Page) 0:30 0:32 0:03 1:05

Discussion

As can be inferred from this test, the init phase (everything before gatsby build) takes ~ 30 seconds. 15 seconds are due to cache re-building and the rest is for other setup-related tasks. Compared to a full build (~ 3min), the savings of ~ 2min can be attributed to the cache plugin. The experimental page build savings (which is <> Gatsby incremental builds) is not significant in this example.

So, compared to Gatsby Cloud, Netlify still looses a lot of time on the init process, and best build times are due to caching effects (a real incremental build for a CMS 1 page edit takes approx 5 seconds for this project).

hey @styxlab - thanks for that thorough post! To keep this area specific to support requests for Build Plugins, I’m actually gonna move this post to a different area that is more focused on discussion so others can weigh in :+1:

I have a similar experience – still takes a minute to rebuild the site from cache.