vita nouva / diary
"The Rose Garden by Carl Aagaard"
29/01/2026

"Diary Entry - January 29, 2026"

20:23 Hugo Build

My Hugo build was taking almost 10 minutes.

Today I finally sat down to fix it. Ran hugo --templateMetrics and the culprit was immediately obvious:

Template                          | Total Time | Calls
----------------------------------|------------|------
_partials/resolve-roam-links.html | 9m 15s     | 866
_partials/native-backlinks.html   | 6m 58s     | 630

I wrote these partials naively. Each one iterates through all pages to build a lookup table (ID → URL, ID → title), uses it once, then throws it away. With ~440 pages, this meant O(n²) complexity. Each page triggers ~440 iterations, so 440 × 440 = ~193,000 iterations just for the ID map. Catastrophic.

The fix was embarrassingly simple, Hugo's partialCached function. Build the lookup tables once, cache them, reuse everywhere.

Created three new cached partials:

  • global-id-map.html — ID → URL map
  • global-title-map.html — ID → title map
  • bib-data.html — bibliography parsing

Then rewrote the slow partials to call these with partialCached.

The build now happens in 1770 ms. 300x faster.

Remember kids, never rebuild data structures you can cache. #Programming

23:57 George Orwell's writing rules

George Orwell's writing rules are quite interesting:

(i) Never use a metaphor, simile, or other figure of speech which you are used to seeing in print.

(ii) Never use a long word where a short one will do.

(iii) If it is possible to cut a word out, always cut it out.

(iv) Never use the passive where you can use the active.

(v) Never use a foreign phrase, a scientific word, or a jargon word if you can think of an everyday English equivalent.

(vi) Break any of these rules sooner than say anything outright barbarous.

[permlink]
c. lr0 2026