13 seconds build time per page

@Natro thanks for the link to the cut-down repository. You wrote:

I checked how long does it take for one page to load and it’s about 13.5 seconds.

I noticed that after deleting a lot of pages a render time per markdown file went down by half.

I’ve profiled the provided repo (running on a MacBook Air M2):

bundle install
bundle exec jekyll build --profile

It took 420 seconds. The repo has 559 markdown files with front matter, so that was under one second per page. Perhaps you were running on a significantly slower platform?

Each page includes the entire navigation hierarchy, so when you double the number of pages, the size of the HTML for the navigation on each page also doubles. I guess your original 2500+ pages would take at least an hour on my platform, which is indeed unacceptably slow.

However, I noticed that your Gemfile.lock includes the line:

    just-the-docs (0.3.3)

That version of the theme was released in October 2020 (see the theme repo at GitHub - just-the-docs/just-the-docs: A modern, high customizable, responsive Jekyll theme for documentation with built-in search.). A significantly improved version (0.4.0) was released on Feb 6. That was before your initial post – but you’re using the theme gem, so you don’t get new releases unless you run bundle update (or delete Gemfile.lock).[1]

bundle update
bundle exec jekyll build --profile

Now building your 559 pages takes 42 seconds on my platform: a 10x speedup! Perhaps I’d build your original 2500+ pages in about 10 minutes.

The code shown by @jhvanderschee is from v0.4.0 of the theme. It was written with performance somewhat more in mind than the corresponding code in v0.3.3 was. However, to provide acceptable speed for building sites with thousands of pages, the navigation would surely need to be generated just once, as @jhvanderschee suggested.

BTW, I don’t understand @jhvanderschee’s remark about front matter (which is presumably referring to @Natro’s repo, not to the theme code). It doesn’t seem at all relevant to the slowness of the build.

I’m surprised to see one of the main Jekyll developers suggesting to create a custom theme, or switch to a competing SSG, for building a site with a few thousand pages! Isn’t Jekyll normally used to build much larger sites with the existing themes?


  1. Using remote_theme: just-the-docs/just-the-docs instead of theme: just-the-docs ensures that you always get the latest theme updates without updating the bundle. ↩︎

1 Like