'Why same .net program run on windows outperforms same program run on linux?

I am benchmarking some very simple non IO operations on windows-x64 and ubuntu.x64.

Given same HW, same load, etc.. Windows outperforms and runs around 30% faster.

The operations I benchmark are Json serialise/deserialise, basic and concurrent collection lookup, addition, deletion, etc..

The way I build the linux program is using command line

dotnet publish App.sln —-framework net6.0 —-configuration Release -—runtime ubuntu.20.04-x64

I have read in some blogs that this is typical and nothing to be surprised about. Can someone please confirm or deny or give a clue what’s happening?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source