Hi,
I have a Hugo project with somewhere in the neighborhood of 15,000 markdown page files. I’m using a custom built theme, and the full build is pretty slow - around 1.5-2mins usually. I’m trying to optimize it, so what I did was create a super basic theme that basically only rendered single pages, and I disabled all custom shortcodes and there’s no lists or pagination or taxonomies. This “basic” theme I made is here: https://github.com/roytang/hugo-theme-basic
Using this theme, it still takes more than half a minute to run a build:
PS C:\repos\blog> hugo --templateMetrics
Building sites …
Template Metrics:
cumulative average maximum
duration duration duration count template
---------- -------- -------- ----- --------
1.5827558s 103.077µs 1.9991ms 15355 _default/single.html
614.2329ms 591.746µs 22.9866ms 1038 _internal/_default/rss.xml
585.6646ms 585.6646ms 585.6646ms 1 _internal/_default/sitemap.xml
1.9988ms 1.927µs 999.4µs 1037 _default/list.html
0s 0s 0s 2 _internal/shortcodes/youtube.html
0s 0s 0s 1 404.html
0s 0s 0s 1 index.html
| EN
+------------------+-------+
Pages | 16393
Paginator pages | 0
Non-page files | 3680
Static files | 1001
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0
Total in 37765 ms
I’m wondering whether this is typically the minimum build time I should be expecting given the number of pages? I need to know what baseline to expect, or if there is any further optimization I can do (which I don’t see any at the moment). If it matters, I’m running on Windows 10 with 16GB of memory and an SSD. (Whether I’m using the SSD or my normal HDD doesnt seem to make a difference though) I also have a lot of images in the both in the static dir and in page bundles in the content dir, if that matters (this basic theme does not include those page resources in the generated HTML). I would guess those are the “non-page files” listed in the log above.
Looking through some older posts here, most of the performance analysis I’ve seen is based on the output of the stepAnalysis flag, but it seems that’s no longer available in my current build of hugo. (“hugo version” tells me that’s “Hugo Static Site Generator v0.58.2-253E5FDC windows/amd64 BuildDate: 2019-09-13T08:06:10Z”). I also saw an old post claiming someone was able to generate 10k posts in around 4s, which is a huge gap from what I have now, so I’m not sure if I’m doing something wrong!
Any advice would be greatly appreciated!