This post documents my measurements of the slow-down caused by the Windows 10 (1903) anti-virus real-time protection of Hugo static website builds, both with and without the Windows Subsystem for Linux (WSL).

Methods

I measured the re-generation of a site with about 2700 pages in total (my personal blog) using Hugo v0.55.5 on this ThinkPad X1 Extreme (i7 8750H, 32GB RAM, Samsung Evo Plus 1TB SSD) with Windows 10 1903, aka the May 2019 update.

For the WSL case, I used Ubuntu 18.04 with Hugo reading its inputs from the Windows filesystem, and generating outputs to the WSL local filesystem.

An example output from Hugo looks as follows (this is the WSL without antivirus case):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
                   |  EN
+------------------+------+
  Pages            | 2746
  Paginator pages  |  201
  Non-page files   | 2521
  Static files     |   23
  Processed images |   40
  Aliases          | 1059
  Sitemaps         |    1
  Cleaned          |    0

Total in 2390 ms

For each of the four configurations, I re-generated the site into the same output directory five times and calculated the averages, which you can see in the table in the next section.

Results

This table shows the average over five runs of the Hugo-reported site generation times for each of the four permutations.

With RT Prot Without RT Prot
cmd.exe 6151.4 ms 2867.6 ms
wsl.exe 23594.8 ms 2109.8 ms

Discussion

For the non-WSL case, Windows real-time protection causes a 2x slow-down.

For the WSL case, the slow-down is an impressive 10x.

Interestingly, WSL without real-time protection is at least as fast, if not faster, than the straight cmd.exe case.

This is great for my workflow, because I make use of WSL for the rsyncing of my sites up to their web-servers.

Conclusion

If you use Hugo on Windows for sites with more than a few hundred pages, significant speed gains can be had by temporarily disabling the real-time protection of the Windows 10 anti-virus.

Updates

Measurement on Linux 2019-07-27

Doing the same Hugo site build on the Ubuntu 19.04 partition on the same SSD in this specific laptop, consistently takes about 1.5 seconds, which is substantially faster than the fastest measurement above.