I am working on designing a theme and am currently trying to optimize. I am having trouble wrapping my mind around partialCached, mostly if there is performance loss. For example, my pagination is different on every pages (list pages show page #s and single pages show the previous and next article).
Is there a difference in performance to have used partialCached when it wasn’t needed? I would assume so, but what is that threshold?
Next, I am using SCSS to build my stylesheet and its my biggest time culprit. My understanding is that Hugo builds in parallel, and if an object isn’t cached yet it goes ahead and begins the process for that page. Since it takes so much longer to process the SCSS, Hugo doesn’t have the time to cache it and thus processes it on the majority of the pages.
In this circumstance, does it even matter to use partialCached?
Already read the docs, came here for a different explanation because they weren’t clear (felt like that was apparent by my original post). I am using templateMetrics but caching is making no or a nominal difference (even when having it only process a partial once).
Sorry, I don’t have an answer to that question, except I would do the same for…
I believe the way to determine that is to experiment, using the template metrics mentioned.
Is the theme you are working on for a project, or as something you will share as a theme for others? I’m interested to know how to optimize a theme in both scenarios, perhaps a theme developer could share their experience.
In my projects I use partialCached if it will render the same each time, but more as a principle; I don’t think many of my sites are large enough to make a noticeable difference (each one builds basically “instantly”).
And look at the “top 10”, any performance issues should “light up like a Christmas three”. The below is the Hugo Docs site (which we have not done any performance tuning with as I can remember) built on my computer. And when, ordered by cumulative duration, the template taking up most time on average takes 9.5ms (and remember that we render in parallel, so we can do 16 of those on my MacBook in that timeframe), I would not worry too much:
Could you post the template metrics? With @jmooring 's help I found mine not to be related to the template caching at all but to the CSS process writing to disk for whatever reason. Although he mentioned putting CSS processing in a separate partial, the way I worked around this was to run tailwind as a separate service altogether which sped it up to an amazing degree.