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
Let’s jump right into the details. Before starting the tests, I had to switch from
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.
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:
- Build command: gatsby build
|Initial build (new cache)||1:35||1:25||0:13||3:13|
|Trigger panel (keep cache)||0:33||0:35||0:04||1:12|
|CMS content edit (1 Page)||0:28||0:30||0:05||1:03|
- Build command: GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
|Initial build (new cache)||1:35||1:25||0:06||2:56|
|Trigger panel (keep cache)||0:26||0:26||0:03||0:55|
|CMS content edit (1 Page)||0:30||0:32||0:03||1:05|
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).