gjtorikian / jekyll-last-modified-at

A Jekyll plugin to show the last_modified_at time of a post.
MIT License
241 stars 38 forks source link

improving render performance via PATH_CACHE usage and bulk `git log ...` call #85

Open klandergren opened 3 years ago

klandergren commented 3 years ago

I have a site with ~1300 documents and wanted to improve its render performance.

Two main observations:

re: PATH_CACHE usage By aligning PATH_CACHE usage in both formatted_last_modified_date and last_modified_at_time the initial site render will be unaffected, but subsequent renders (e.g. after site reset when jekyll detects a change while running jekyll serve) will see improvement.

Pros:

Caveats:

An example of this implementation is at https://github.com/klandergren/jekyll-last-modified-at/tree/use-path-cache

re: git log ... calls scaling w/ number of documents Both initial site render and subsequent renders will see improvement if we replace the 1:1 calls with a single git log call and cache its data. The call ends up fast enough that we can flush the cache during reset so users will always have a freshly determined last_modified_at (presumed to be preferable).

Pros:

Caveats:

An example of this implementation is at https://github.com/klandergren/jekyll-last-modified-at/tree/cache-git-information

I will open each of these improvement approaches as separate pull requests so you can evaluate.

Thanks for creating this plugin!