Simple benchmarks to run to test WSL2 vs Windows Native

I just upgraded to the new Windows May update which now has WSL 2 (a very lightweight, Hyper V VM running full Linux). I essentially now want to move all my development over to Linux. But I would like to test if there are any regressions in performance when running Julia on the VM compared with the native binary.

What are some of your favorite snippets of code to run benchmarks?

From the non Julia benchmarks Iā€™ve seen, wsl2 sometimes performs on par with a regular Ubuntu install. So I understand it to be a big improvement over the first attempt.

The most relevant benchmarks are always your own programs, so Iā€™d probably start there. Otherwise, you could run the benchmarks from the Julia homepage.

The general consensus is that the performance of WSL2 is on par with a native install (given the Type 1 hypervisor), but only if you stay within the VHD and the linux FS. As soon as you start reading/writing to /mnt/c/ (i.e. to the Windows FS), things slow down tremendously

I would like to see these benchmarks (some or all, at least some multi-threaded too, i.e. where load is close to 100% on more than one of the four), but note itā€™s expected to get better numbers, e.g. I do roughly 2x on my Linux box (some programs there are faster with lower opt settings, I was meaning to point out, and NOT asking for threads):

$ hyperfine '~/julia-1.6.0-DEV-8f512f3f6d/bin/julia -O0 --cpu-target=core2 --startup-file=no pidigits.jl 10000 >/dev/null'
Benchmark #1: ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia -O0 --cpu-target=core2 --startup-file=no pidigits.jl 10000 >/dev/null
  Time (mean Ā± Ļƒ):      1.292 s Ā±  0.054 s    [User: 1.669 s, System: 0.501 s]
  Range (min ā€¦ max):    1.196 s ā€¦  1.366 s    10 runs

And please time ā€œfirst-plotā€, in another discourse thread, where I showed this recently, someone said this doesnā€™t work on Windows:

$ sudo apt-get install gnuplot

$ time ~/julia-1.5-ea669c3d3e/bin/julia -O1 --compile=min --startup-file=no -e "using Gaston; display(plot(rand(10)))"

real	0m0,691s  # without display 0m0,400s, and also try other settings.
user	0m0,768s
sys	0m0,542s

File intensive operations like git clone, npm install, apt update, apt upgrade, and more are all be noticeably faster with WSL 2. [ā€¦] WSL 2 run up to 20x faster compared to WSL 1

https://www.reddit.com/r/bashonubuntuonwindows/comments/bn9pfi/difference_between_wsl2_and_bare_bones_virtual/

WSL 2 is a virtual machine, but in their words ā€œnot like any VM youā€™ve seen beforeā€. They utilize a very minimal HyperV toolset to run the Linux kernel.

Iā€™m not sure how helpful this thread is or possibly outdated:
https://dev.to/lietux/comment/l6dl

1 Like

Did you install the Linux version of Julia? Do you know if it is possible to use the Windows version of Julia? What is the difference?

Here is one data point: Comparison of Windows 10 and Linux Julia

1 Like

Thanks for the useful performance info! For my own daily usage, Julia version installed on Ubuntu 20.04 WSL2 is totally fine, except that I probably have to make some extra effort to display plots. It was very confusing at first when I tried to install WSL2 because currently it is only available in the test version of Win10. I am still looking for an elegant way of plotting through WSL2.

GMT.jl works fine in WSL. It has to since it mostly produces Postscript that is then converted (automatically or not) to other formats.

Gnuplot.jl or Gaston.jl?