Archive

All 170 articles posted since 2013, tagged with a combination of 193 unique keywords.

By Tag (193)

There's only one post tagged cms

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:

{% flickr_photo 11804351333 "Medium 640" %}

Then each time my site was rebuilt, my slightly customised flickr_photo.rb would output the following into my generated static page:

<div class="photo-holder" style="max-width:62.5em;">
    <a href="https://www.flickr.com/photos/chrisbevan/11804351333/">
        <img class="photo pure-img" src="https://farm3.staticflickr.com/2874/11804351333_f60d27348c_b.jpg" title="Ugly" alt="Ugly" />
    </a>
</div>

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):

real    3m46.577s
user    2m23.729s
sys     0m1.891s

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:

real    0m16.786s
user    0m14.381s
sys     0m2.372s

Quite a difference.

Continue reading →