beulogue is fast enough

2020-10-29 Last modified on 2021-05-24

The beulogue adventure began a year and a half ago, to start playing with Crystal.

It was fast, and I made it slow

hugo is a great tool to generate a static site, but for me it brings to many things. A goal of beulogue is to be as simple as possible. That is why I made the choice of using mustache as the templating engine in the beginning.

The problem I encountered is that I had to hack a bit in the templating engine to bring some shortcodes, which are not native in mustache.

A few weeks ago, I switch to a jinja-like templating engine (using crinja) to have shortcodes working in a less hacky way.

And this made beulogue "slow", here are the measures in beulogue v3 (with mustache) and v5 (with crinja):

beulogue v3:

  • Site for language en (101 pages) built in 171.31ms.
  • Site for language fr (16 pages) built in 27.98ms.

beulogue v5

  • Site for language en (101 pages) built in 578.65ms.
  • Site for language fr (16 pages) built in 152.27ms.

😯 beulogue v4 does not exist! beulogue uses only numbers from the Fibonacci sequence!

A benchmark for static site generators

I discovered the following article: Comparing Static Site Generator Build Times, which benchmarks the following site generators:

Time to try with beulogue! Please note that this benchmark only study the number of document processed, generating a lot of lorem ipsum markdown documents.

I forked the original repository into this one where I have added beulogue (see this commit).

Oh, and my computer is quite old so everything runs quite slowly.

Base

For the "base" dataset, we run each generator on 1 document only.

Frameworks performance for 1 document

beulogue wins! :trophy:

Small dataset

For the "small" dataset, we run each generator on [0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024] documents.

Frameworks performance for small sites

beulogue performs quite well, close to Hugo for small sites, with a weird progression to join Eleventy in the end. Let's see how it goes for larger sites.

Large dataset

For the "large" dataset, we run each generator on [1000, 2000, 4000, 8000, 16000, 32000, 64000] documents. This takes quite some time!

Frameworks performance for large sites

beulogue stays close to Eleventy. Jekyll and Next.js are a bit faster.

The performance issue

When I ran the benchmarks, in particular the ones with a lot of files (about 4000 markdown files), I noticed that the performance was less and less good.

I used the Time API from Crystal to find the hot point(s).

I managed to fix the issue which was pretty dumb, as usual: I created a new template parser for each page, but I only really needed one!

The fix is part of beulogue v5.1.0 and we are close to the performance of v3!

beulogue is fast enough

beulogue generates a 64000 pages sites in 95 seconds on my old computer.

It is fast enough.

On a side note, beulogue is available on