New Hugo versions are much more memory intensive?

This is not a topic I know much or anything really about, so please keep that in mind while reading this post.

I’m using the latest Hugo release. A pattern I’ve been noticing over the last couple of big releases, perhaps since v0.50+, is that Hugo has become more memory intense.

What I mean by this is that when I run hugo server, my laptop fans kick into gear, and it takes a lot of time for the page to load. Once the page has loaded and I change something in the code, I usually need to stop hugo server and run it again as the server seems to stall.

Opening up several pages on my project at the same time doesn’t work. They just won’t load. It’s the loading spinner that appears in the tabs on Chrome.

My code has remained relatively the same over these releases. There are inefficiencies in my code for sure, but this has not been an issue before.

Template Metrics (I’ve deleted the stuff that doesn’t have a significant duration):

 cumulative       average       maximum         
   duration      duration      duration        count     template
 ----------      --------      --------        -----     --------
  8m41.211367643s   276.065343ms   454.23932ms     1888      _default/single.html
  3m31.112957173s   327.30691ms    734.747077ms    645       products/single.html
  2m49.5149515s     155.375757ms   467.073252ms    1091      partials/stock.html
  2m47.316752359s   76.680454ms    305.836178ms    2182      partials/description.html
  2m29.799815199s   20.992126ms    128.953456ms    7136      partials/post.html
  2m18.933273058s   505.211902ms   1.515880437s    275       _default/keywords.html


 |  EN   
-------------------+-------
  Pages            | 3001  
  Paginator pages  |    0  
  Non-page files   |    0  
  Static files     |  704  
  Processed images |    0  
  Aliases          |    2  
  Sitemaps         |    1  
  Cleaned          |    0  

Total in 277931 ms

I’m using a MacBook Pro for development.

When running hugo server, this is what Activity Monitor shows:

**CPU**
Process name: hugo
% CPU: 372,8
CPU time: 8:31,39

**Memory**
Process name: hugo
Memory: 1,16 GB

I can’t share my project which I appreciate makes this difficult to troubleshoot. Just wondering if this is normal Hugo behaviour and the problem are my templates? Thanks.

It’s your templates.

Ok, fair.

But is the CPU and Memory usage normal with just hugo and chrome (one tab open with localhost) running? My templates haven’t changed much, but something seems to have changed with hugo over all these releases perhaps that makes it more cpu intensive to run?

We have a fairly good benchmark suite and I watch it carefully before releasing. And the recent Hugo versions have been trending toward significantly faster and more memory effective. I have written about this elsewhere, so I’m not going into details here. However, you have a very special project. A 300 second build time for 3K pages is too much and suggests that you need to look at your project. If these are big files you may consider running the server with:

hugo server --renderToDisk

Thanks. Will give it a go.

This topic was automatically closed after 21 hours. New replies are no longer allowed.