Hugo is fast, but ineffecinet templates can make it slower. For checking the performance you can use the below commands.
Use
hugo --logLevel debug
to display debug information, warning, and error message.Use
hugo --templateMetrics
to check for slow templates. This will show the time it takes to render each template.Use
hugo --gc
(garbage collection) to clean up unused files, which might help reduce build time.Use
debug.Timer
to determine the execution time of a block of code. And use thehugo --logLevel info
info command line flag when you build the site.
{{ $t := debug.Timer "TestSqrt" }}
{{ range seq 2000 }}
{{ $f := math.Sqrt . }}
{{ end }}
{{ $t.Stop }}
What are your thoughts on this post?
I’d love to hear from you! Click this link to email me, I reply to every message!
Also use the share button below if you liked this post. It makes me smile, when I see it.