I have a small personal blog built using Jekyll and GitHub pages. Recently when building/serving the site locally it takes 12-40 minutes sometimes to build. Previously it would take a minute or two on this PC, though I've added maybe 10 posts since then. The two files that are taking the longest haven't changed in a looong time but I understand they're the main templates to build off of.
I have run the --profile
tag a number of times and the problem is with my _layouts/post.html
and _includes/post/related_posts.html
, here is my latest build:
>jekyll build --profile
Configuration file: C:/Users/twulz/Documents/GitHub/Twulz.github.io/_config.yml
Source: C:/Users/twulz/Documents/GitHub/Twulz.github.io
Destination: C:/Users/twulz/Documents/GitHub/Twulz.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
Populating LSI...
Rebuilding index...
| Filename | Count | Bytes | Time |
+------------------------------------------------------------+-------+----------+----------+
| _layouts/post.html | 44 | 559.39K | 769.523 |
| _includes/post/related_posts.html | 47 | 49.21K | 769.309 |
| _layouts/default.html | 70 | 2448.54K | 1.615 |
| _includes/asides.html | 70 | 1218.71K | 1.115 |
| _includes/asides/archive_tabs.html | 70 | 926.82K | 0.556 |
| _includes/asides/recent_posts.html | 70 | 223.95K | 0.383 |
| _includes/libs/list_tags | 115 | 626.27K | 0.325 |
| _includes/libs/list_categories | 115 | 319.43K | 0.219 |
| index.html | 1 | 9.07K | 0.185 |
| _includes/libs/list_pages | 96 | 63.14K | 0.164 |
| page3/index.html | 1 | 9.35K | 0.153 |
| page4/index.html | 1 | 8.19K | 0.146 |
| blog/tags.html | 1 | 53.22K | 0.137 |
| atom.xml | 1 | 505.68K | 0.127 |
| page2/index.html | 1 | 8.91K | 0.115 |
| _includes/navbar.html | 72 | 207.96K | 0.108 |
| _includes/post/post_meta.html | 47 | 62.26K | 0.085 |
| blog/categories.html | 1 | 26.61K | 0.073 |
| _layouts/single-with-sidebar.html | 3 | 9.25K | 0.067 |
| page5/index.html | 1 | 3.56K | 0.062 |
| assets/bootstrap-2.3.2/js/bootstrap.custom.js | 1 | 27.96K | 0.058 |
| assets/bootstrap-2.1.1/js/bootstrap.custom.js | 1 | 18.45K | 0.057 |
| _includes/libs/truncate_exec | 5 | 1.49K | 0.049 |
| _includes/bottom.html | 72 | 95.14K | 0.043 |
| _includes/head.html | 72 | 132.24K | 0.042 |
| blog/archives.html | 1 | 11.13K | 0.034 |
| _includes/post/post_pagenation.html | 47 | 22.74K | 0.029 |
| sitemap.xml | 1 | 10.63K | 0.026 |
| assets/js/script.js | 1 | 4.50K | 0.022 |
| _includes/footer.html | 72 | 13.08K | 0.018 |
| assets/bootstrap-2.3.2/css/bootstrap.custom.css | 1 | 103.51K | 0.017 |
| assets/css/style.css | 1 | 9.11K | 0.016 |
| _includes/asides/tweets.html | 70 | 38.62K | 0.016 |
| _layouts/single-no-sidebar.html | 2 | 20.16K | 0.013 |
| assets/bootstrap-2.3.2/css/bootstrap-responsive.custom.css | 1 | 16.57K | 0.013 |
| _includes/script.html | 72 | 23.91K | 0.010 |
| _includes/header.html | 72 | 12.16K | 0.009 |
| rss.xml | 1 | 7.57K | 0.006 |
| home.html | 1 | 2.01K | 0.006 |
| _includes/asides/about.html | 70 | 13.95K | 0.004 |
| _includes/libs/thumbnail | 44 | 0.00K | 0.003 |
| _posts/2016-08-17-prusa3dPrinter-electronics.md | 1 | 4.21K | 0.003 |
| engprojects/other/index.html | 1 | 1.58K | 0.003 |
| engprojects/printer/index.html | 1 | 1.51K | 0.002 |
| _posts/2016-02-18-rediscovering-the-blog.md | 1 | 18.79K | 0.002 |
| engprojects/cube4x4x4/index.html | 1 | 1.39K | 0.002 |
| _posts/2018-10-10-Building-a-smart-parking-demo.md | 1 | 5.36K | 0.002 |
| _includes/libs/truncate_start | 5 | 0.00K | 0.002 |
| _includes/post/socials_large.html | 3 | 3.71K | 0.002 |
| _includes/bootstrap-2.3.2/css/bootstrap.min.css | 1 | 103.51K | 0.002 |
+------------------------------------------------------------+-------+----------+----------+
| TOTAL (for 50 files) | 1450 | 8064.52K | 1544.978 |
done in 794.05 seconds.
Auto-regeneration: disabled. Use --watch to enable.
here is _layouts/post.html
- I have already removed the social network tags (if you compare to my Github Repo )
---
layout: default
group: Blog
---
<article class="single post">
<header>
<h1>
<a href="{{ site.baseurl }}{{ page.url }}" rel="bookmark" title="Permanent link">{{ page.title }}</a>
</h1>
<p class="meta">
<time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: site.date_format }}</time>
</p>
</header>
<div class="content">
{{ content }}
<br>
</div>
<footer>
{% include post/post_pagenation.html %}
{% include post/post_meta.html %}
{% include post/related_posts.html %}
</footer>
</article>
_includes/post/related_posts.html
, I have tried making the related posts loop only output 1 post - other posts show that the loops increase the build time in the realm of from 1s to 60s but it didn't drastically change the build time for me.
<nav id="related-posts" class="well">
<h3>You might also like</h3>
<ul>
{% for post in site.related_posts limit:5 %}
<li class="related-post">
<span>{{ post.date | date: site.date_format }}</span> -
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
</nav>
I have uninstalled and re-installed Jekyll but no change. What have I done wrong here - what else can I look at to try to bring down this local build time?
As GitHub Pages doesn't support lsi anyway, setting lsi:false in my _config.yml file was enough to allow my local builds to cut down to 15 seconds.
As shown by user ashmaroli above, this isn't the true answer to why my build times were suddenly increased, but as my question was "What else can I look at to try to bring down this local built time?" this fix is sufficient for my needs to let me edit and serve locally in a more reasonable timeframe (and now matches the production site) so I am marking this as solved.