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

perf(build): use jekyll-include-cache plugin to reduce build time #1098

Merged
merged 1 commit into from
Jun 19, 2023

Conversation

cotes2020
Copy link
Owner

Description

Resolves #1094

Type of change

  • Improvement (refactoring and improving code)

Additional context

Improvements to:

How has this been tested

  • I have run bash ./tools/test (at the root of the project) locally and passed
  • I have tested this feature in the browser

@cotes2020
Copy link
Owner Author

Hi @jakerr, the include of the dynamic file is removed in this PR, what do you think?

Copy link
Contributor

@jakerr jakerr left a comment

Choose a reason for hiding this comment

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

Looks great thank you!
I just found the one case where the template needs dynamic page info (the sidebar) I checked all of the other templates and they look good to cache to me.

Here's the perf for this change checked locally (on this site it was 4 minutes without this change):

Build Process Summary: 

| PHASE    |   TIME |
+----------+--------+
| RESET    | 0.0001 |
| READ     | 2.0448 |
| GENERATE | 0.0375 |
| RENDER   | 9.8069 |
| CLEANUP  | 0.0042 |
| WRITE    | 0.1675 |
 

Site Render Stats: 

| Filename                                                           | Count |      Bytes |  Time |
+--------------------------------------------------------------------+-------+------------+-------+
| _layouts/page.html                                                 |  1168 | 122040.89K | 6.781 |
| jekyll-theme-chirpy-6.0.1/_includes/related-posts.html             |   326 |   3514.48K | 6.367 |
| _layouts/default.html                                              |  1168 | 248613.28K | 1.806 |
| _includes/head.html                                                |  1168 |   5208.82K | 0.810 |
| jekyll-theme-chirpy-6.0.1/_includes/js-selector.html               |  1168 |    854.92K | 0.300 |
| jekyll-theme-chirpy-6.0.1/_includes/sidebar.html                   |  1168 |   2961.32K | 0.299 |

_layouts/default.html Outdated Show resolved Hide resolved
_layouts/tags.html Show resolved Hide resolved
@jakerr
Copy link
Contributor

jakerr commented Jun 19, 2023

Oh one more thing. How are you enabling the plugin? Is it automatic?
I thought I had to add this in _config.yml:

plugins:
  - jekyll-include-cache

@cotes2020
Copy link
Owner Author

cotes2020 commented Jun 19, 2023

Oh one more thing. How are you enabling the plugin? Is it automatic? I thought I had to add this in _config.yml:

plugins:
  - jekyll-include-cache

For the source code project here, the plugin is referenced in the jekyll-theme-chirpy.gemspec file.

spec.add_runtime_dependency "jekyll-include-cache", "~> 0.2"

For users who use the gem package, currently until the new Chirpy gem is released, the jekyll-include-cache plugin needs to be imported in the Gemfile.

Resolve #1094 and add margin bottom for layout tags

Co-authored-by: Jake Kerr <kodafox@gmail.com>
@jakerr
Copy link
Contributor

jakerr commented Jun 19, 2023

For the source code project here, the plugin is referenced in the jekyll-theme-chirpy.gemspec file.

Ah thanks. I wasn't aware of the difference between depending on _plugins in a Jekyll site and depending on them from normal libs when writing plugins. Found a bit of info on that here.

This PR looks good to me.

@cotes2020
Copy link
Owner Author

In fact, there is no need to modify _config.yml to use the plugin, you can use the :jekyll_plugins Gemfile group

@cotes2020 cotes2020 merged commit 4fe145e into master Jun 19, 2023
6 checks passed
@cotes2020 cotes2020 deleted the reduce-build-time branch June 19, 2023 06:41
otzslayer pushed a commit to otzslayer/otzslayer.github.io that referenced this pull request Jun 21, 2023
…otes2020#1098)

Resolve cotes2020#1094 and add margin bottom for layout tags

Co-authored-by: Jake Kerr <kodafox@gmail.com>
jakerr added a commit to vernonmileskerr/vernonmileskerr.github.io that referenced this pull request Jun 25, 2023
PR: cotes2020/jekyll-theme-chirpy#1098

Once this code is available in the latest gem we can remove our overrides
vmk-press added a commit to vernonmileskerr/vernonmileskerr.github.io that referenced this pull request Nov 13, 2023
PR: cotes2020/jekyll-theme-chirpy#1098

Once this code is available in the latest gem we can remove our overrides
vmk-press added a commit to vernonmileskerr/vernonmileskerr.github.io that referenced this pull request Nov 13, 2023
PR: cotes2020/jekyll-theme-chirpy#1098

Once this code is available in the latest gem we can remove our overrides
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caching of expensive templates during rendering (trending-tags)
2 participants