Hugo on Windows is slower 2x than WSL2

Hi, I found that build on Windows is slower than on WSL2, tested on same machine multiple times, any ideas?

Source: GitHub - hbstack/theme: HB starter theme for blog, docs, digital garden, gallery and landing pages.

Command: hugo --gc --enableGitInfo


Windows 11

I created a test site that resizes and converts over 100 very large images. Before each test I (a) close my IDE (VS Code) to eliminate delays related to the file watcher, and (b) delete the resources directory.

Linux: 20 s
Windows: 21 s (project in C:\temp, Hugo installed via prebuilt binary for Windows)
Windows via WSL: 19 s (project in /mnt/c/temp, Hugo installed via prebuilt binary for Linux)

The differences are noise.

I just noticed you are accessing the .GitInfo properties. Do you get the same results when that is disabled?

Are you running a third-party virus scanner on Windows (BitDefender, Avast, etc.)? If yes, disable and test again.

Do you terminate WSL before testing the Windows build? I know that WSL can eat some memory, but it shouldn’t be significant on a system with 16 GB RAM.

Thanks for your response.

I removed the enableGiInfo from the build command, but still slower than WSL2.

No, I use Windows 11 built-in antivirus, and I disable the real-time antivirus protection on the Windows Security Panel when testing.

I try to shut down the WSL (wsl --shutdown), and close any running programs (IDEs and others) and re-run the build on Windows, but the result is same that slower 2x than WSL.

Would you mind sharing your test site?

Just create a site with 100 very large images in the assets directory, and do something like:

{{ range resources.Match "*.jpg" }}
  {{ with .Resize "200x webp" }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}
1 Like

When building the site from the Windows OS:

  1. How did you install Hugo?
  2. Are the project files on the C drive?
  3. Is the publishDir on the C drive?
  4. Is anything watching the publishDir (e.g., MS OneDrive, DropBox, Google Drive, etc.)?

I’m using scoop to install Hugo, I also tested with the Hugo binary which download from GitHub releases, but got same result.

Yes, all files are saved in C drive, I have only one partition (I guess so did the WSL).

No, I have OneDrive installation, but didn’t use it to watch any folder (haven’t logged in and enabled the sync yet).

Additional info, your code snippet works as same on both WSL and Windows (tested with 200x 367kb images).



So, some aspect of your project behaves differently.

1 Like

Have no clue about this, since there is no platform specified codes in the project, will check which parts/functions are slower than Linux, and post it here if found any.


wsl --list --verbose
  NAME      STATE           VERSION
* Ubuntu    Running         2

Tested other themes (my hugo-theme-bootstrap and the Google docsy), same slower than WSL. Screenshots of docsy example.



Would you mind testing the GitHub - google/docsy-example: An example documentation site using the Docsy Hugo theme on your machine? I don’t have another machine for testing and confirming whether if it is machine/environment issue.

I saw a difference when testing the Docsy example, but there’s a lot going on there.

So I created a test site with 999 markdown files—nothing else.

git clone --single-branch -b hugo-forum-topic-45332 hugo-forum-topic-45332
cd hugo-forum-topic-45332

WSL: 100ms (multiple runs)
Windows: 300ms (multiple runs)

Then I moved the markdown files into the static directory, taking Goldmark out of play. The results were the same.

So, to me, this just looks like an IO performance difference.

1 Like

Thank you very much for taking time on this. <3

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.