How I reduced my Jekyll build time by 61%


#1

I recently benchmarked Jekyll’s master branch and managed to lower my build time by more than 60%. I also wrote a detailed step by step post covering all the changes I made.

You can read the full post on the Forestry.io blog


#2

This is really great! I was able to reduce 50% the building time. Change to commonmark is not possible for me right now, but I implemented all the rest recommendations and so far so good.

Thanks a lot.


#3

by the way… you mention in the post that you have to add .jekyll-cache to the .gitignore file. I think that .jekyll-cache should be added to the _config.yml file in the exclude: part:

exclude:
  - .jekyll-cache

If you don’t, jekyll become to build non-stop. :joy:


#4

You’re welcome. I’m glad it was helpful.

Yes CommonMark takes a bit of work. I had cluttered my posts with css classes. The solution was to style these elements directly from the stylesheet. You may also need to enable UNSAFE option.


#6

you’re right @lpuerto for now .jekyll-cache has to be excluded, especially if you use the --livereload option!


#7

Thanks for your feedback Colin, on average websites like yours running incremental and livereload options locally should offer a decent development experience.


#8

Thanks for letting me know @lpuerto. I just had some time to test this out myself and I can see the issue you mentioned.

@Frank Yes, it is a massive improvement. Looking forward to V4 :star_struck:


#9

By the way, Jekyll new Cache API can have an impact on existing plugins, especially those who memoize values.

If you use jekyll-seo-tag for instance, you’ll have to use the no-cache-drop branch or your page metadata will not be properly displayed.

Same goes for other core plugins like jekyll-feed or jekyll-github-metadata

Here’s my current Gemfile for the core plugins:

  gem "jekyll-seo-tag", github: "jekyll/jekyll-seo-tag", branch: "jekyll-cache"
  gem "jekyll-feed", github: "jekyll/jekyll-feed", branch: "jekyll-cache"
  gem "jekyll-github-metadata", github: "jekyll/github-metadata", branch: "no-cache-drop"

v4 might break other existing plugins. We encourage plugin developers to test their plugins with lastest master or wait for next beta release to do so.

It should be clearly emphasized that this is still beta software, the core team aims at a Jekyll v4.0.0.beta1 release before March 31th, when support for Ruby 2.3 goes EOL.


#10

Note:
In case there are adventurous developers using Jekyll’s master branch (mainly changes for v4.0) to use the “Cache API”, do note that, the “Cache API” refers to the use of Jekyll::Cache class and its public methods. It does not break plugins that use memoized methods.

That above behavior is due to an unrelated change which memoizes the method that parses Liquid Templates and therefore requires the resulting Liquid::Template object to receive an “un-memoized Drop data”.