Please see the disclaimer.

There has been at least one experience I had where performance mattered, and I recently ran into another one.

I switched to Jekyll, a static site generator to streamline my website. And it worked pretty well.

When writing a post, I had Jekyll running in debug mode, and it was fast enough. It took about three seconds to generate the site.

Wait, what?

Yes, three seconds. That is actually bad, but it was fast enough for writing a post.

However, it was a different story for building a production version of the site for uploading. That took about 120 seconds.

WHAT?!

Yeah, it sucked. I didn’t have that many plugins. In fact, the following list is all the plugins I had:

  • jekyll-paginate
  • jekyll-sitemap
  • jekyll-youtube
  • jekyll-seo-tag
  • jekyll-compose
  • jekyll-archives
  • jekyll-minifier
  • embed-img (my own plugin)

And each of those plugins was either necessary (like jekyll-paginate or jekyll-minifier) or not expensive at build time, like jekyll-compose.

I even removed the use of jekyll-zopfli (for gzip compression) and used a build script to run it in parallel on all of the relevant files. In fact, I did that when trying to increase the performance of Jekyll, but it only reduced the time to 100 seconds. It turns out that compression didn’t even come close to dominating the execution time!

Yikes!

But all of that was not enough to convince me to abandon Jekyll. What did convince me was that Jekyll’s build time increased by about five seconds per post that I added. Five seconds. Per post.

At this point, I have about 20 posts in the pipeline. If I were to write all of them, Jekyll would be 100 seconds slower.

Looking at that fact, I knew that using Jekyll was unsustainable, so I decided to abandon it before it got worse.

So I started looking around, and I quickly found Hugo. It claims to be the fastest, and it seems to be able to do what I needed done, so I decided to try it by porting my custom Jekyll theme to a Hugo theme.

It did not go well at first; Jekyll and Hugo and very different ideas about how to do things, and I had to relearn how to do everything. Fun. Also, replacing some Jekyll capabilities proved difficult, so my theme did change a bit.

However, at the end of it, I had everything I needed. And I even got to use Table of Contents in my posts, though I had to create a Pull Request to add a setting to generate ordered lists.

And the result is that my site generates in 8.23 seconds, of which 8 seconds is used in compression on 8 cores. Now, compression does dominate, but I have already parallelized it. And 8 seconds is fine for a production build. It’s like compiling with optimizations: you expect it to take longer.

Anyway, if there is a lesson here, it is that performance matters. Both Jekyll and Hugo are O(n) in the number of pages/posts, but the constant is wildly different. One is ridiculous and unusable, and that makes the other the only choice.

If you write software, and it is slower than it could be, then you are doing it wrong. Period.