Hugo build time

I was just wondering if the build time for my project is normal. I’m using v0.30.2.

Started building sites ...

Built site for language en:
0 draft content
0 future content
0 expired content
2597 regular pages created
194 other pages created
0 non-page files copied
297 paginator pages created
22 categories created
38 tags created
total in 56250 ms

I’m sure there are other things you might need to know to determine if this is a normal build time or not, but I’m not sure what that information is so please let me know and I’ll provide what I can.

You’d have to find a site with content similar to yours to make an accurate comparison. However, you can check template metrics to see what is happening on a template level. It should help you optimize. :slight_smile:

1 Like

Thanks, I’ll take a look.

Let me just follow up and ask:

I use a lot of if else statements throughout my project, does this have a negative effect on build time?

I just checked template metrics on my site and got the following:

   duration      duration      duration  count  template
 ----------      --------      --------  -----  --------
  3m30.658795341s   84.772151ms    248.6292ms   2485  partials/head.html
  3m26.982256856s   41.646329ms  195.904056ms   4970  partials/metadescription.html

So it seems that all those if else statements are probably the issue.

We won’t be able to comment without seeing the code, so share a link if it is online.

Also, check out partialCached. Depending on which parts are conditionals, you can probably reduce the builds for any partial that only needs to be rendered once, and then reused everywhere. :slight_smile:

1 Like

It’s an offline project so unfortunately can’t share. Appreciate the help and links you’ve provided. Thank you.

It looks like you’re using some complex statements on every single page. I’ve got some sites with a lot of queries that still take < 3 seconds, so you really should look at those and see if you can simplify. Unfortunately, I doubt there’s much more than that we can do without seeing your code.

Posts asking about “how to improve build time” need to show the source code.

2 Likes