piston icon indicating copy to clipboard operation
piston copied to clipboard

dotnet vs mono Performance

Open Ephaltes opened this issue 3 years ago • 1 comments

Hello,

I wanted to know, if there is any way to speed up dotnet 5 cli compiling and execution time. I know that there is mono, but mono only supports c# language version up to 7 and not like dotnet to 9.

But the performance of dotnet 5 cli is really slow in Piston, it takes up to 8x more time to compile the same code.

Dotnet Payload:

{
    "language": "c#.net",
    "version": "*",
    "files": [
        {
            "name": "my_cool_code.cs",
            "content": "namespace Test { class HelloWorld { static void Main(string[] args) {System.Console.WriteLine(\"Hello World\");}}}"
        }
    ],
    "stdin": "",
    "args":"",
    "compile_timeout": 10000,
    "run_timeout": 3000,
    "compile_memory_limit": -1,
    "run_memory_limit": -1
}

Mono payload:

{
    "language": "mono",
    "version": "*",
    "files": [
        {
            "name": "my_cool_code.cs",
            "content": "namespace Test { class HelloWorld { static void Main(string[] args) {System.Console.WriteLine(\"Hello World\");}}}"
        }
    ],
    "stdin": "",
    "args": "",
    "compile_timeout": 10000,
    "run_timeout": 3000,
    "compile_memory_limit": -1,
    "run_memory_limit": -1
}

on the public api Mono needs: 1,5s while dotnet needs about 8s on a selfhosted api Mono needs 0,6s while dotnet needs about 4s

Mono Public Api 20211017123829_000037

Dotnet Public Api 20211017123942_000038

Mono selfhosted Api 20211017124044_000039

Dotnet selfhosted Api 20211017124104_000040

Could it be due to how the projects are restored and build in dotnet and mono that there is that big of a difference?

Ephaltes avatar Oct 17 '21 10:10 Ephaltes

With mono we directly call csc, but with dotnet 5, it was my understanding that we need to use the dotnet command line, and by extension the MSBuild suite to properly build a DLL file which we can the run.

If there is a better way to do this, I would be more than happy to do so.

HexF avatar Oct 17 '21 10:10 HexF