Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache parsed template #231

Merged
merged 1 commit into from
Aug 24, 2017
Merged

Cache parsed template #231

merged 1 commit into from
Aug 24, 2017

Conversation

benbalter
Copy link
Collaborator

I added debug output to SeoTag#template and realized that for every page with SEO tag called, we're (A) calculating the template path, (B) reading in the template, and (C) parsing it.

Of course, we only have one template, and that template stays the same between pages (crazy how templates work, right?), so we may as well cache it on the class, rather than the instance.

This PR exposes SeoTag.template, a memoized class variable, so we parse the template on SEO tag's first call, and not on each subsequent call.

On my personal site, build time went from about 16 seconds to about 14.

Copy link
Member

@DirtyF DirtyF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no small victory: on Jekyll's website, time build decreased by 1s. ✌️

@benbalter benbalter merged commit 29cbdee into master Aug 24, 2017
@benbalter benbalter deleted the cache-template branch August 24, 2017 18:26
@jekyll jekyll locked and limited conversation to collaborators Apr 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants