Boosting my Jekyll rebuild times
For a while now I’d been using the jekyll-flickr plugin for adding Flickr images to posts on this here site.
All you need is the Flickr photo ID and size you want to use. When rebuilding my Jekyll site, the plugin would cleverly use Flickr’s API to reach out, grab the raw image URL for the choosen size, before replacing the short-and-sweet plugin code for the long-form HTML markup required to properly display my Flickr image.
For example, I add this to my post:
Then each time my site was rebuilt, my slightly customised
flickr_photo.rb would output the following into my generated static page:
As you can imagine, this looked like a good idea at the time. Unfortunately, and as I found out, there were a few significant pitfalls.
Rebuilding my site now required an internet connection. No connection,
jekyll build would throw a fit.
When I had a connection, the time required to rebuild was heavily contingent on the quality of my internet connection.
Even with a blazingly fast connection, all those API round-trips started adding up pretty quickly.
Which left me with the following indicative time for rebuilding (
time jekyll build) all 817 entries containing 124 individual Flickr images (generated on my current and frankly terrible 3.4Mbs ADSL+ connection):
After stripping out all those handy liquid tags and replacing them with old-school image tags, then deleting the
flickr_photo.rb plugin file, my generation times are now down to this:
Quite a difference.