Skip to content
This repository has been archived by the owner. It is now read-only.

Improve Site build times with cached includes #629

Closed
ashmaroli opened this issue Sep 20, 2018 · 2 comments
Closed

Improve Site build times with cached includes #629

ashmaroli opened this issue Sep 20, 2018 · 2 comments

Comments

@ashmaroli
Copy link

@ashmaroli ashmaroli commented Sep 20, 2018

馃憢 Michael

Did you know that you can cache rendered outputs from stateless includes and improve your build times with a plugin..?
The plugin is called jekyll-include-cache and is whitelisted for use at GHP
(just not bundled by default, since its dangerous for novices)

The plugin can be used to cache any "include" that does not change its output from page-to-page.
Such includes can simply be plain HTML without any Liquid or an include that only references the global constant {{ site }} e.g., src/_includes/footer.html

I did not submit a PR because I thought I'd gather your feedback first and allow you to implement it first-hand so that you know where it can be used and where it should not be used..

Results from --profile on my system show that you may be able to shave of ~15 seconds but I may be wrong..

@mmistakes

This comment has been minimized.

Copy link
Owner

@mmistakes mmistakes commented Sep 20, 2018

Nice! I definitely have a few includes that could benefit from this. Will have to give it a try.

Not sure of the impact it'll have. Most of my build times are stuck building tons of paginated tag/category pages with the jekyll-paginate-v2 plugin.

@ashmaroli

This comment has been minimized.

Copy link
Author

@ashmaroli ashmaroli commented Sep 20, 2018

Not sure of the impact it'll have

I'm guessing at most 15-20s.. Also, you can gain more time by avoiding unnecessary fragmentation.
For example, inserting the contents of related.html include into post layout will free Jekyll from having to parse and render the include each time the post layout is rendered (exactly 1002 times according to output from --profile)
Of course, the above observation would be futile if related.html was being included in more than one layout.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can鈥檛 perform that action at this time.