Single file application slow on osx-x64 runtime
I originally thought this was a dotnet runtime issue but a single file executable basic console app is quicker on all runtimes than invoking dotnet run.
However once you add the Microsoft.Testing.Platform then a osx-x64 single file executable takes a lot longer.
Benchmarks are here: https://github.com/thomhurst/SlowOsx64SingleFile/actions/runs/10811251824
Basic reproduction is available in that repository too.
Do you know if this reproes only on M1 or also on Intel chip on MacOS?
Do you know if this reproes only on M1 or also on Intel chip on MacOS?
Don't know off the top of my head. Whatever the GitHub actions macos-latest uses
the benchmark you shared run on M1. Thanks.
still observable.
Interesting, I am wondering if we should ping some people from runtime so we could maybe have some pointers on what could have such big impact.
That was the original thought, but it only reproes when our packages are added, so I guess we need some traces at least, before bothering runtime people, postponed till my wife lends me her Mac 😁
Any plans to address this? You can see in TUnit, at the bottom of the readme, I've got benchmarks, and all are slower on Mac
No specific plans yet, it has been opened on my computer for a while, but I don't have a mac to debug this on, so I will try to get traces when running on hosted machine and see if there is something to see.
I tried it and it seems that the benchmark is incorrect. The benchmark compares dotnet run, which is running natively on arm64, with the single file app that is built for non-native x64, and hence is virtualized and slower.
https://github.com/thomhurst/SlowOsx64SingleFile/pull/1
This is what I see when I fix the build to use osx-arm64. Comparable data with some small overhead probably caused by the singlefileappness.
https://github.com/thomhurst/TUnit/blob/main/run-singlefile-tests.ps1#L27 same thing happening here, you probably want to detect the architecture. Or use arm64 for macos if you use the latest images, because they are arm64 https://github.com/actions/runner-images?tab=readme-ov-file#available-images
Results from run on native:
Doh! It's always something so simple isn't it?
Thanks for finding that!
If only it was always this simple :)