-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increased Runtime Duration for Java Functions in .NET Android Compared to Xamarin Android #9601
Comments
Are you testing Debug or Release configurations? One change I'm aware of is that Debug uses an interpreter instead of a JIT for a better debugging experience. You can disable this with @jonathanpeppers Any other thoughts? |
@MrAlbin you don't mention what configuration you were using to test this. AOT, LLVM, Interpreter, etc.? Debug mode has an interpreter by default in .NET 6+, while Xamarin had no interpreter at all. Can you share the BenchmarkDotNet project(s)? I know there are currently a few workarounds to even run BenchmarkDotNet on Android. |
I use Release configuration. The sample app can be found here: https://github.com/MrAlbin/Benchmark |
I noticed you run BenchmarkDotNet in a custom way: How do things compare if you run the standard BenchmarkDotNet pipeline like this: BenchmarkDotNet does some statistics that is over my head, so I trust they do a better job at the math than I would by manually using |
Oh wait, you aren't using BDN at all. I just saw classes named |
I had initially tried BenchmarkDotNet but had issues getting it running with Xamarin Android. Thus I have done it without any benchmark library. |
Android framework version
net9.0-android, net8.0-android
Affected platform version
VS 2022 17.12.3
Description
I recently converted a Xamarin Android app to .NET Android (net8.0-android). I noticed that while the startup performance has improved, other functions are taking longer to execute at runtime. This is particularly evident when executing Java functions. In a simple comparison between Xamarin and .NET, I measured the following times for executing Java.Lang.Math.Sqrt:
How can this significant performance difference be explained?
Attached is a speedscope file that I recorded for the .NET app.
dotnet-dsrouter.exe_20241208_140545.speedscope.json
Steps to Reproduce
N/A
Did you find any workaround?
N/A
Relevant log output
The text was updated successfully, but these errors were encountered: