piston
piston copied to clipboard
dotnet vs mono Performance
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

Dotnet Public Api

Mono selfhosted Api

Dotnet selfhosted Api

Could it be due to how the projects are restored and build in dotnet and mono that there is that big of a difference?
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.