okjuan / vbook

0 stars 0 forks source link

Improve perf #17

Closed okjuan closed 4 months ago

okjuan commented 4 months ago

Resolves #16

Inspired by suggestion 4 in this article about improving Jekyll site build time, I removed unused bits and simplified includes in the site. Before and after each change, I ran bundle exec jekyll build --profile to see how the impacted the build performance.

Baseline:

Filename                                                            | Count |    Bytes |  Time
--------------------------------------------------------------------+-------+----------+------
_layouts/base.html                                                  |   318 | 2575.98K | 2.957
_includes/head.html                                                 |   516 |  833.76K | 1.607
_layouts/tag_page.html                                              |   197 |  897.39K | 1.328
_includes/header.html                                               |   319 |  412.77K | 0.888
_includes/posts_list.html                                           |   198 |  696.47K | 0.213
_includes/footer.html                                               |   319 |  100.93K | 0.131
_layouts/post.html                                                  |   120 |  453.28K | 0.107
jekyll-remote-theme-20240617-61304-iuueme/_includes/social.html     |   319 |   11.21K | 0.028
...

Remove unused social.html:

Filename                                                            | Count |    Bytes |  Time
--------------------------------------------------------------------+-------+----------+------
_layouts/base.html                                                  |   318 | 2551.75K | 2.310
_includes/head.html                                                 |   516 |  833.76K | 1.401
_layouts/tag_page.html                                              |   197 |  897.39K | 1.226
_includes/header.html                                               |   319 |  412.77K | 0.801
_includes/posts_list.html                                           |   198 |  696.47K | 0.184
_layouts/post.html                                                  |   120 |  453.28K | 0.085
_includes/footer.html                                               |   319 |   76.63K | 0.057
...

Remove <footer> code to base.html and delete footer.html:

Filename                                                            | Count |    Bytes |  Time
--------------------------------------------------------------------+-------+----------+------
_layouts/base.html                                                  |   319 | 2563.06K | 2.233
_layouts/tag_page.html                                              |   197 |  897.39K | 1.196
_includes/head.html                                                 |   516 |  833.76K | 1.178
_includes/header.html                                               |   319 |  412.77K | 0.840
_includes/posts_list.html                                           |   198 |  696.47K | 0.202
_layouts/post.html                                                  |   120 |  453.30K | 0.090
...

Eliminate extra reference to head.html from tag_page.html:

Filename                                                            | Count |    Bytes |  Time
--------------------------------------------------------------------+-------+----------+------
_layouts/base.html                                                  |   319 | 2277.42K | 2.171
_includes/header.html                                               |   319 |  412.77K | 0.803
_includes/head.html                                                 |   319 |  547.36K | 0.657
_layouts/tag_page.html                                              |   197 |  611.76K | 0.418
_includes/posts_list.html                                           |   198 |  696.47K | 0.177
_layouts/post.html                                                  |   120 |  453.30K | 0.089
...

Move <head> code to base.html and delete head.html:

Filename                                                            | Count |    Bytes |  Time
--------------------------------------------------------------------+-------+----------+------
_layouts/base.html                                                  |   319 | 2279.91K | 1.785
_includes/header.html                                               |   319 |  412.77K | 0.724
_layouts/tag_page.html                                              |   197 |  611.76K | 0.394
_includes/posts_list.html                                           |   198 |  696.47K | 0.145
_layouts/post.html                                                  |   120 |  453.30K | 0.118
...