Mireille Raad's blog
Goofy things, code, data, unfamiliar ideas and stuff worth sharing.
home / blog / datacode
Shell scripts to benchmark Hugo's build times

TL;DR

This GitHub repo has some shell scripts that let you benchmark Hugo’s build times.


I was doing a project that curates Twitter threads from a set of users then shows them on a webpage, in near-realtime, in a nice-to-read article format. I also had search and a few other features.

I wanted to see if building this porject on the JAMstack with Hugo is feasible. The idea is to monitor a user’s timeline for threads and save them as markdown files. One file per thread.

Generating the markdowns is more or less straightforward. However, re-building the site everytime someone adds a tweet to a thread seemed to be resource intensive. Twitter moves fast and I needed the site to update in real-time.

To test how fast Hugo can really handle rebuilds, I created a set of shell scripts. They take dummy content, replicate it x times then rebuild the site n times. There is a wait time in between builds to free up memory.
The build times and the specs of the machine are saved to a csv for analysis. This way I could test out speed improvements from tweaking the theme, configuring caching or changing configuration variables. I could also test if increasing the hardware specs was worth it.

You can find the code on this link.

I was more than happy with Hugo’s ability to generate content. Hugo could easily handle a set of 50 or 100 users. I tested builds with up to 50,000 posts.