Is Windows in general always slower than linux?
TL;DR depends on the use case with up to 12 times between best/worst

Comprehensive testing has been done over at Phoronix (28.03.18) and the results are very mixed. The tests looked at:


Clear Linux 21510
Debian 9.4
OpenSUSE 42.3 Leap
Ubuntu 16.04 LTS
Windows 10 Pro Build 16299
Debian 9 On WSL
OpenSUSE 42.3 On WSL
Ubuntu 16.04 LTS On WSL


The results are all over the show. In a few tests, the WSL (Windows Subsystem for Linux) is faster then native Windows (GraphicsMagick) and the Intel optimized distribution, Clear Linux, sometimes has the worst results (Netperf UDP request response). While in others Windows is twice as fast as all Linux distributions (CacheBench). All in all, deciding on performance is not conclusive. Choose the OS that provides the tooling you require.

Nonetheless, the article itself does provide a winner given that only first place finishes are taken into account:


  ... Clear Linux was the fastest of the operating systems tested with
  coming in first 40% of the time, Debian 9.4 in second with first place
  finishes 22.5% of the time, and Windows 10 Pro itself was the fastest
  12.5% of the time.


When only taking Java into account:


  In the Java tests, to no real surprise, the performance tended to be
  about the same across all tested operating systems.


And finally, in a compile test (Golang), which is the test that is most related to the use case in the question:


  The build performance on Windows 10 and WSL were slower than the bare
  metal Linux performance.