-
Notifications
You must be signed in to change notification settings - Fork 922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Site generation slows down for large sites #144
Comments
Huh, that's strange, one of the reasons I use Hugo is because of how fast it is - let me investigate. |
Hi there, can I check a few things? What are you running hugo on (platform, OS, etc.) and can I have a look at the repo? |
@LisaFC Sure thing! Here's an example repo: https://github.com/qmfrederik/docsy-perf . It's essentially the sample site, with a new commit which adds auto-generated documentation. This is on Ubuntu 18.04 (x64), with a recent version of Hugo:
|
Ok, I tried on Debian with Hugo 0.55 extended and I'm getting almost identical timings. It looks like it's the time it's taking to build the autogenerated left nav with that many nested pages, a huge amount of time seems to be spent in the sidebar. However, that partial should be cached. I'll poke around with it a bit more. |
So taking the partialCached out made it even slower... It's definitely building the sidebar though because if I took that out your site built in 4 seconds. Let's see if it's possible to speed things up a bit. |
Gripping developments, but what happened next? :-) |
What happened next is that I still haven't managed to make it any faster. :( I suspect just building a big nested navbar on the fly with Javascript is just kind of time-consuming. Will give it another go when I have a moment, or happy for someone else to try! |
I'm also starting to hit this. Has anyone found a different theme where sidebar generation is faster? If so, maybe we can review their code. |
I changed the {{ define "section-tree-nav-section" }}
{{ $s := .section }}
{{ $p := .page }}
{{ $shouldDelayActive := .delayActive }}
{{ $active := eq $p.CurrentSection $s }}
{{ $show := or (and (not $p.Site.Params.ui.sidebar_menu_compact) ($p.IsAncestor $s)) ($p.IsDescendant $s) }}
{{ $sid := $s.RelPermalink | anchorize }}
<ul class="td-sidebar-nav__section pr-md-3">
<li class="td-sidebar-nav__section-title">
<a href="{{ $s.RelPermalink }}" class="align-left pl-0 pr-2{{ if not $show }} collapsed{{ end }}{{ if $active}} active{{ end }} td-sidebar-link td-sidebar-link__section">{{ $s.LinkTitle }}</a>
</li>
{{ if $show }}
<ul>
<li class="collapse show" id="{{ $sid }}">
{{ $pages := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true }}
{{ $pages := $pages | first 50 }}
{{ range $pages }}
{{ if .IsPage }}
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
{{ $active := eq . $p }}
<a class="td-sidebar-link td-sidebar-link__page {{ if and (not $shouldDelayActive) $active }} active{{ end }}" id="{{ $mid }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{ else }}
{{ template "section-tree-nav-section" (dict "page" $p "section" .) }}
{{ end }}
{{ end }}
</li>
</ul>
{{ end }}
</ul>
{{ end }} |
Closing this as no activity for 2 years -- please feel free to reopen if there's more to report! |
I'm trying to use Hugo + Docsy to generate a site for a library. The idea is that the site includes a reference section, with individual pages for classes, methods and so forth.
I've found that the site generate slows down drastically as you add more pages to the site. For example, generating a site with about 3100 pages takes close to one minute.
That seems a bit excessive to me, so I wanted to check back here and see if that's expected behavior?
Here's the output of
hugo --templateMetrics
:The text was updated successfully, but these errors were encountered: