# Hugo on Windows is slower 2x than WSL2

**URL:** <https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332>\
**Category:** support\
**Created:** [July 18, 2023, 4:05am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332 "2023-07-18T04:05:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 18, 2023, 4:05am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/1 "2023-07-18T04:05:22Z")

</div>

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.](https://github.com/hbstack/theme)

Command: `hugo --gc --enableGitInfo`

WSL2

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/3/b/3b98a85dc6335d5d2184d037b8b2a1153e942840.png)

Windows 11

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/9/3/9351a272638711d3e6ee03d50b02103a48b9eb7f.png)

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 18, 2023, 8:10pm UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/2 "2023-07-18T20:10:20Z")

</div>

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.

> [@razon](#):
>
> any ideas?

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.

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 19, 2023, 1:07am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/3 "2023-07-19T01:07:45Z")

</div>

Thanks for your response.

> [@jmooring](#):
>
> I just noticed you are accessing the `.GitInfo` properties. Do you get the same results when that is disabled?

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

> [@jmooring](#):
>
> Are you running a third-party virus scanner on Windows (BitDefender, Avast, etc.)? If yes, disable and test again.

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

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/1/f/1fd3e566c835dc9bbc9154a0cc0fe4425d2801d6.png)

> [@jmooring](#):
>
> Do you terminate WSL before testing the Windows build?

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.

> [@jmooring](#):
>
> I created a test site that resizes and converts over 100 very large images.

Would you mind sharing your test site?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 19, 2023, 1:13am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/4 "2023-07-19T01:13:23Z")

</div>

> [@razon](#):
>
> Would you mind sharing your test site?

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

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

```

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 19, 2023, 1:25am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/5 "2023-07-19T01:25:59Z")

</div>

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.)?

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 19, 2023, 1:44am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/6 "2023-07-19T01:44:18Z")

</div>

> [@jmooring](#):
>
> How did you install Hugo?

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

> [@jmooring](#):
>
> Are the project files on the C drive?  
> Is the publishDir on the C drive?

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

> [@jmooring](#):
>
> Is anything watching the publishDir (e.g., MS OneDrive, DropBox, Google Drive, etc.)?

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).

Windows

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/d/3/d33d29030d8466e1a75e8ec2e18c0ec4e11436ec.png)

WSL

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/3/e/3e325196a4c752883f2a1211d7af80a5c5fb4da3.png)

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 19, 2023, 1:49am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/7 "2023-07-19T01:49:13Z")

</div>

> [@razon](#):
>
> code snippet works as same on both WSL and Windows

So, some aspect of your project behaves differently.

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 19, 2023, 2:36am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/8 "2023-07-19T02:36:09Z")

</div>

> [@jmooring](#):
>
> So, some aspect of your project behaves differently.

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.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 19, 2023, 2:39am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/9 "2023-07-19T02:39:39Z")

</div>

FYI

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

```

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 19, 2023, 3:36am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/10 "2023-07-19T03:36:05Z")

</div>

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

WSL

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/e/1/e17cde790cd8d9133f411e38cda8fb0236de1473.png)

Windows

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/1/4/14727fe5bbd99a80f191644851124ca3728c4538.png)

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

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [July 19, 2023, 4:50am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/11 "2023-07-19T04:50:48Z")

</div>

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.

```plaintext
git clone --single-branch -b hugo-forum-topic-45332 https://github.com/jmooring/hugo-testing hugo-forum-topic-45332
cd hugo-forum-topic-45332
hugo

```

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.

---

<div class="post-metadata">

**Author:** ![razon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/razon/32/14882_2.png) [@razon](https://discourse.gohugo.io/u/razon)\
**Post date:** [July 19, 2023, 7:10am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/12 "2023-07-19T07:10:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [July 21, 2023, 7:11am UTC](https://discourse.gohugo.io/t/hugo-on-windows-is-slower-2x-than-wsl2/45332/13 "2023-07-21T07:11:28Z")

</div>

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