Performance of WSL, Cygwin and Bare-Bone Linux on Generating This Website
2019-05-07 2019-05-30
Today Microsoft anounced the new WSL2 (Windows Subsystem for Linux), which will be shipped later this year. It supposed to be 20 times faster than the current WSL. I have used WSL for about one year and jumped back to Linux due to the performance issue of the former one. The WSL is definitive faster than Cygwin, but it is unusable for a few tasks. Here is an example for the performance of WSL(1), Cygwin and the bare-bone system on the generation of this website at current status.

This static site is generated by self-made bash scripts. The scripts invoke each other recursively (thus, many forks). The process involves plenty file test commands (querying the file system attributes) and generates a lot of temporary and output files (heavy IO of tiny files). This will be a critical performance benchmark for WSL and Cygwin. The benchmarks are performed on the same laptop with dual booting into Win 10 and Fedora 29.

Linux Native
real    0m2.462s
user    0m1.059s
sys     0m1.679s
Cygwin 3
real    1m19.374s
user    0m9.304s
sys     0m32.134s

Cygwin 3,
root excluded
from antivirus

real    1m16.906s
user    0m7.852s
sys     0m28.655s

Cygwin 3,
antivirus disabled

real    1m9.040s
user    0m7.500s
sys     0m24.274s
WSL at /mnt/c
real    0m22.634s
user    0m1.203s
sys     0m12.453s

WSL at /home
real    0m25.646s
user    0m1.125s
sys     0m14.594s

WSL at /mnt/c,
antivirus disabled

real    0m13.488s
user    0m1.156s
sys     0m12.109s

WSL at /home,
antivirus disabled

real    0m14.374s
user    0m1.063s
sys     0m13.406s
Win10 1809
Hyper-V gen2
Ubuntu 18.04 LTS

real    0m1.869s
user    0m1.725s
sys     0m0.497s
The performance of both emulators are unacceptable for this task, even if the Microsoft antivirus software is turned off. Let us look forward to the 20 times performance improvement in the coming WSL2.

Edit 2019-05-30: Add Hyper-V result