microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.47k stars 822 forks source link

Asus Merlin Firmware build time on WSL2 is much slower than Hyper-V #5159

Closed bplasmeijer closed 4 years ago

bplasmeijer commented 4 years ago

Please fill out the below information:

I am building the Asus Merlin firmware on WSL2 Ubuntu 18.04, and the gap between building on Hyper-V vs WSL2 is to big I think.

Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz

Hyper-V WSL2
real 57m17.494s 92m53.131s
user 49m40.129s 69m45.330s
sys 5m48.929s 10m59.973s

I did expect better performance on WSL2 against Hyper-V.

0xbadfca11 commented 4 years ago
onomatopellan commented 4 years ago

On an intel i5 9400F @ 2.90Gz + 16Gb RAM + Ubuntu 18.04 WSL2 installed on a NVME drive

Creating ASUS RT-AC68U firmware to image/RT-AC68U_384.17_0.trx

TRX Image:
 Total Size .... : 35938304 (35096.0 KB) (34.3 MB)
 CRC-32 ........ : 15DC8BE1

[...]

real    23m40.987s
user    34m11.656s
sys     2m48.549s

I didn't notice any slowdown. Before compiling I just call sudo umount /mnt/* and I get rid of any possible slowdown/conflict with /mnt/ path or binaries.

bplasmeijer commented 4 years ago

On an intel i5 9400F @ 2.90Gz + 16Gb RAM + Ubuntu 18.04 WSL2 installed on a NVME drive

Creating ASUS RT-AC68U firmware to image/RT-AC68U_384.17_0.trx

TRX Image:
 Total Size .... : 35938304 (35096.0 KB) (34.3 MB)
 CRC-32 ........ : 15DC8BE1

[...]

real    23m40.987s
user    34m11.656s
sys     2m48.549s

I didn't notice any slowdown. Before compiling I just call sudo umount /mnt/* and I get rid of any possible slowdown/conflict with /mnt/ path or binaries.

The sudo umount /mnt/* has an huge impact on the build process.

Creating ASUS RT-AC68U firmware to image/RT-AC68U_384.17_0.trx

TRX Image: Total Size .... : 35934208 (35092.0 KB) (34.3 MB) CRC-32 ........ : 5276E5F4

md5sum image/RT-AC68U_384.17_0.trx > image/RT-AC68U_384.17_0.md5

[...]

Hyper-V WSL2 WSL2 unmount /mnt/*
real 57m17.494s 92m53.131s 25m29.447s
user 49m40.129s 69m45.330s 38m29.852s
sys 5m48.929s 10m59.973s 2m56.057s

cc: @craigloewen-msft

RMerl commented 4 years ago

Unmounting /mnt/c made a huge difference. The laptop's Ryzen 5 4500U now is barely slower than the desktop's i7 7700K running VMWare. Here's the results on the laptop:

real 25m16.443s user 37m27.081s sys 3m15.141s

I'll retry just editing PATH instead of unmounting /mnt/c. Makes me wonder if it's really necessary for PATH to include the whole Windows host path by default?

bplasmeijer commented 4 years ago

both builds on a clean WSL instance

wsl --import ubuntu-1804-merlin d:\wsl C:\users\bartp\Downloads\bionic-server-cloudimg-amd64-wsl.rootfs.tar.gz
wsl -d ubuntu-1804-merlin
cd $HOME
curl https://gist.githubusercontent.com/bplasmeijer/155ead2a78780ae1639cab1de472be2f/raw/6a5a17aa2844345339e4d2b8eb3a3bdbd6503e34/install.sh -o install.sh
cd amng-build/release/src-rt-6.x.4708/
git checkout mainline
time make rt-ac68u
WSL2 WSL2 unmount /mnt/*
real 100m6.521s 41m16.261s
user 76m55.139s 59m53.277s
sys 13m6.121s 5m16.163s 2m56.057s

cc: @craigloewen-msft @RMerl

bplasmeijer commented 4 years ago

Unmounting /mnt/c made a huge difference. The laptop's Ryzen 5 4500U now is barely slower than the desktop's i7 7700K running VMWare. Here's the results on the laptop:

real 25m16.443s user 37m27.081s sys 3m15.141s

I'll retry just editing PATH instead of unmounting /mnt/c. Makes me wonder if it's really necessary for PATH to include the whole Windows host path by default?

If you have the numbers @RMerl please share.

Biswa96 commented 4 years ago

Unmounting /mnt/c made a huge difference.

That can be configured easily in /etc/wsl.conf file:

[automount]
enabled=false
[interop]
appendWindowsPath=false

Learn more about it in blog post at: https://aka.ms/wslconf

bplasmeijer commented 4 years ago

Unmounting /mnt/c made a huge difference.

That can be configured easily in /etc/wsl.conf file:

[automount]
enabled=false
[interop]
appendWindowsPath=false

Learn more about it in blog post at: https://aka.ms/wslconf

Not working on WSL2 @craigloewen-msft

RMerl commented 4 years ago

Unmounting /mnt/c made a huge difference. The laptop's Ryzen 5 4500U now is barely slower than the desktop's i7 7700K running VMWare. Here's the results on the laptop: real 25m16.443s user 37m27.081s sys 3m15.141s I'll retry just editing PATH instead of unmounting /mnt/c. Makes me wonder if it's really necessary for PATH to include the whole Windows host path by default?

If you have the numbers @RMerl please share.

Sorry, I forgot to try it before uninstalling WSL2 (I'm working on something else on the same laptop that requires VirtualBox, which is incompatible with WSL2).

Anyone else still able to do the same test, just editing the PATH? If not, I'll look into uninstalling VBox/reinstalling WSL2 over the weekend for a quick test.

onomatopellan commented 4 years ago

Unmounting /mnt/c made a huge difference.

That can be configured easily in /etc/wsl.conf file:

[automount]
enabled=false
[interop]
appendWindowsPath=false

Learn more about it in blog post at: https://aka.ms/wslconf

Not working on WSL2 @craigloewen-msft

It works here. You will need to wsl --shutdown from cmd after the change. I also used nano to edit the /etc/wsl.conf file.

bplasmeijer commented 4 years ago

Unmounting /mnt/c made a huge difference.

That can be configured easily in /etc/wsl.conf file:

[automount]
enabled=false
[interop]
appendWindowsPath=false

Learn more about it in blog post at: https://aka.ms/wslconf

Not working on WSL2 @craigloewen-msft

It works here. You will need to wsl --shutdown from cmd after the change. I also used nano to edit the /etc/wsl.conf file.

Please share /etc/wsl.conf file @onomatopellan , Thanks

onomatopellan commented 4 years ago

It's a very simple wsl.conf. With this Windows folders doesn't appear on PATH. https://gist.github.com/onomatopellan/82474407d6c31076cbd7d6e0ee56e947

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/toolchains/crosstools-arm-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin:/opt/toolchains/crosstools-aarch64-gcc-5.3-linux-4.1-glibc-2.22-binutils-2.25/usr/bin:/opt/toolchains/crosstools-arm-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/bin:/opt/toolchains/crosstools-aarch64-gcc-5.5-linux-4.1-glibc-2.26-binutils-2.28.1/usr/bin:/opt/brcm-arm/bin
RMerl commented 4 years ago

Maybe as one last datapoint from me: doing the same build under Virtualbox:

real    30m6.395s
user   40m24.860s
sys    5m36.421s

So on this laptop, WSL2 is clearly faster than VBox when compiling a fairly large project (after taking care of the path issue).

RMerl commented 4 years ago

I guess this issue can be closed now. The recommended solution is to edit /etc/wls.conf to disable adding the Windows search path to the PATH variable - doing that fully resolved the performance issues for me.