We are developing a cross platform app on a PCL, but for the time being we are only using android devices for testing.
Our concern is that its taking about 6 to 8 seconds (depending on which device we test it) to start the app, which is very slow.
After placing a few breakpoints we saw that the timing is consumed pretty evenly.
We did notice this particular parts took longer:
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
Page mainPage = new LogScreen();
(creating the main page to then set it as main navigation page).Xamarin support will end on May 1, 2024 for all Xamarin SDKs. Android 13 and Xcode 14 SDKs (iOS and iPadOS 16, macOS 13) will be the final versions Xamarin will target.
Forms. . NET Multi-platform App UI (MAUI) is a multi-platform technology for developing mobile (iOS and Android) and desktop (Windows and Mac) applications.
Though both Xamarin and React Native offer near-native performance, Xamarin runs the fastest code on Android and iOS and has a user interface (UI) for using native tools. TLDR: In Xamarin vs. React Native, Xamarin has more brownie points for native-like performance. Xamarin wins.
First thing I would recommend is to not benchmark a debug build of your app, the code paths of the Mono runtime and Jit'd code are not the same as a release build, the use of shared runtimes, assembly sizes, etc, etc, etc. will all effect the startup and execution times.
Here are examples of startup times of a "very large" aggressively tuned Android Forms-based app on high-end and low-end devices using an in-house benchmarker (conditionally compiled in, not injected, and using the OS's system clock).
MainActivity
will add:
Times are generated via a shell script that reboots the devices, monitors the startup to wait for the system to settle, launches a series of apps (GApps, Facebook, Instagram, Twitter, etc...), waits for the system to settle, and then launches the Forms app via:
export deviceTime=$(echo "$(adb -s $deviceID shell cat /proc/uptime | awk '{print $1}') * 1000" | bc -l)
adb -s $deviceID shell am start -n com.sushihangover.GeneticCancerDNAMapper/com.sushihangover.GeneticCancerDNAMapper.DevOpsDashboard --el startTime ${deviceTime%.*}
I GeneticCancerDNAMapper: 0.162 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnCreate
I GeneticCancerDNAMapper: 0.164 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.base.SetTheme
I GeneticCancerDNAMapper: 0.201 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.base.OnCreate
I GeneticCancerDNAMapper: 0.244 : Xamarin.Forms.Forms.Init
I GeneticCancerDNAMapper: 0.266 : Realms.Realm.GetInstanceAsync ~Get Instance & Data~
I GeneticCancerDNAMapper: 0.324 : Realms.Realm.GetInstanceAsync ~Obtained Instance & Data~
I GeneticCancerDNAMapper: 0.324 : Xamarin.Forms.Application Content
I GeneticCancerDNAMapper: 0.349 : Xamarin.Forms.Application Content ~Creation Completed~
I GeneticCancerDNAMapper: 0.353 : Xamarin.Forms.Application.MainPage ~Displayed~
I GeneticCancerDNAMapper: 0.43 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication
Re: https://en.wikipedia.org/wiki/Android_One
I/GeneticCancerDNAMapper(10904): 2.453 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnCreate
I/GeneticCancerDNAMapper(10904): 2.467 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.base.SetTheme
I/GeneticCancerDNAMapper(10904): 2.731 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.base.OnCreate
I/GeneticCancerDNAMapper(10904): 3.016 : Xamarin.Forms.Forms.Init
I/GeneticCancerDNAMapper(10904): 3.166 : Realms.Realm.GetInstanceAsync ~Get Instance & Data~
I/GeneticCancerDNAMapper(10904): 3.571 : Realms.Realm.GetInstanceAsync ~Obtained Instance & Data~
I/GeneticCancerDNAMapper(10904): 3.571 : Xamarin.Forms.Application Content
I/GeneticCancerDNAMapper(10904): 3.772 : Xamarin.Forms.Application Content ~Creation Completed~
I/GeneticCancerDNAMapper(10904): 3.799 : Xamarin.Forms.Application.MainPage ~Displayed~
I/GeneticCancerDNAMapper(10904): 4.457 : Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With