Skip to content
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

asciidoc: Rebuild time increases by factor 40 from 0.123.0 onwards #12375

Open
toorog opened this issue Apr 15, 2024 · 4 comments
Open

asciidoc: Rebuild time increases by factor 40 from 0.123.0 onwards #12375

toorog opened this issue Apr 15, 2024 · 4 comments

Comments

@toorog
Copy link

toorog commented Apr 15, 2024

I am building a page containing ~250 asciidoc files. Using the same content + config, these are the re-build times when touching a file while hugo server is running:

  • v0.122.0: ~1.4s
  • v0.123.0 and newer: >40s

For >0.123.0 the debug logging shows that on every change, all pages are being rebuild. Whereas with 0.122.0 and before, only the changed page was rebuild. This might be related to the following changelog entry:

New dependency tracker for partial server rebuilds. This quickly calculates the delta given a changed resource (e.g. a content file, template, JS file etc.) and supports transitive relations.

However, I was not able to dig any deeper since there's no commit or issue linked.

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z

Does this issue reproduce with the latest release?

Yes

@bep bep changed the title Page build time increases by factor 40 from 0.123.0 onwards asciidoc: Rebuild time increases by factor 40 from 0.123.0 onwards Apr 15, 2024
@bep bep removed the NeedsTriage label Apr 15, 2024
@bep bep added this to the v0.126.0 milestone Apr 15, 2024
bep added a commit that referenced this issue Apr 15, 2024
@bep
Copy link
Member

bep commented Apr 15, 2024

I created a test case in 74e9129 -- assuming it would fail, but it doesn't.

Which means that we would need more information to figure out what happens (e.g. the full site source).

A general note:

  • Before 0.123.0 you would often have a situation where we did "too little work" on rebuilds, which resulted in stale page listings etc.
  • In 0.123.0 the change detection is much more accurate and we try do be so fine grained as possible; in combination with "fast render mode" it has worked very well for me (and I'm a fairly active Hugo user).

@toorog
Copy link
Author

toorog commented Apr 16, 2024

I meanwhile stripped my page down to a minimal example that already shows an increase from ~100ms to ~1s rebuild time for 20 (empty) pages when using 0.123.0 or newer.

This is the setup I use:

hugo.yaml

baseURL: 'https://example.com'
languageCode: 'en-us'
title: 'ASCIIDoc Performance Test'
theme: hugo-geekdoc
watch: true
security:
  exec:
    osEnv:
      - (?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM|GEM_HOME)$

    allow:
      - "^python$"
      - "^asciidoctor$"
timeout: 120s

taxonomies:
  tag: tags
  category: categories

enableGitInfo: true

markup:
  asciidocExt:
    attributes: {}
    backend: html5
    extensions: [
      "asciidoctor-diagram"
    ]
    failureLevel: fatal
    noHeaderOrFooter: true
    preserveTOC: true
    safeMode: unsafe
    sectionNumbers: false
    trace: false
    verbose: false
    workingFolderCurrent: true

content/Page<n>.adoc (I copied this file 10 times and replaced <n> with an actual number)

---
title: Page <n>
---
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor, nunc nec

include::../include.adoc[]

_index.adoc

---
title: Mainpage
---
[pass]
{{< toc-tree >}}

include.adoc

This is some included text

Also downloaded the Geekdoc template in version 0.45.0 and extracted it to themes/hugo-geekdoc

@TiGR
Copy link

TiGR commented Apr 16, 2024

@toorog I have the similar issue in #12095 (seems to be the same issue). Have you tried running hugo with --logLevel debug ̇? In this case it dumps some information about cachebuster and showing some page dependencies that needs to be rebuilt. In my case I see a lot of unrelated files rebuilding on each edit. Do you see the same?

@jmooring
Copy link
Member

jmooring commented Apr 16, 2024

This is a minimal example matching @toorog's description:

git clone --single-branch -b hugo-github-issue-12375 https://github.com/jmooring/hugo-testing hugo-github-issue-12375
cd hugo-github-issue-12375
hugo server

The Geekdocs theme has several menu partials that walk the content tree, so I'm not surprised that a change in one place requires everything to be re-rendered. I haven't spent any time looking at whether the partial calls are cached, or if that would help the situation. AsciiDoc rendering via Hugo is very slow compared to Markdown rendering, which amplifies the difference in rebuild times when comparing versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants