Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Feedback] Xamarin Forms Startup Time Slow #3722

Closed
samhouts opened this issue Sep 5, 2018 · 13 comments
Closed

[Feedback] Xamarin Forms Startup Time Slow #3722

samhouts opened this issue Sep 5, 2018 · 13 comments
Labels
a/performance e/10:clock10: 10 feedback-ticket Issue originates from https://developercommunity.visualstudio.com help wanted We welcome community contributions to any issue, but these might be a good place to start! m/high impact ⬛ t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!

Comments

@samhouts
Copy link
Member

samhouts commented Sep 5, 2018

Description

  • VS2107 (the one released Tuesday), only the CrossPlatform option installed (added UWP Xamarin support)
  • Create Cross Platform Project>Single View using Xamarin Forms
  • (VS made projects for Android, iOS and UWP)
  • Switched to Release build.
  • Compiled and deployed to 3 real devices:
  • Samsung S7 (Startup time is 2 seconds)
  • LG Nexus 5 (Startup time is 3 seconds)
  • Asus Nexus 7 [2012] (Startup time is 4 seconds)

    The measured startup time for all of the above was measured by closing all previously started apps

    Then running the release build of the app manually on the phone and counting the time until the "Welcome to Xamarin Forms!"

    is displayed.

    Those times are totally unacceptable.

    To put this in perspective, Apple had a bit of a scandal when they first introduced their AutoLayout mechanism... it added

    150 milliseconds to the start time and developers were (quite reasonably in my view) upset. (Apple has since greatly improved things.)

    You've added 2000 to 4000 milliseconds to start time.

    But hey, what's an order of magnitude between friends! :-)

    ____________

    Developer Community URL: https://developercommunity.visualstudio.com/content/problem/27969/xamarin-forms-startup-time-slow.html

    ______________

Source

395078

@samhouts samhouts added feedback-ticket Issue originates from https://developercommunity.visualstudio.com a/performance labels Sep 5, 2018
@charlesroddie
Copy link

Are there automated metrics of startup time? I have seen more useful info in the Xamarin forums giving both AOT and non-AOT startup times, but can't find the thread right now.

@yunusefendi52
Copy link

I think it's not just Xamarin.Forms what causes the startup time slow, it's also cause by Xamarin.Android (already filed an issue here and here the project board)

@samhouts samhouts added the inactive Issue is older than 6 months and needs to be retested label Mar 18, 2019
@samhouts samhouts added help-wanted up-for-grabs We welcome community contributions to any issue, but these might be a good place to start! help wanted We welcome community contributions to any issue, but these might be a good place to start! and removed help-wanted labels Jun 28, 2019
@MhAllan
Copy link

MhAllan commented Oct 15, 2019

Too slow startup, any updates on this?

@samhouts samhouts added m/high impact ⬛ and removed inactive Issue is older than 6 months and needs to be retested labels Feb 6, 2020
@LeonWhelan
Copy link

Hi, Any chance this is even being worked on? An update would be great.

@mnxamdev
Copy link

We are trying to get a UWP app out the door using the Xamarin.Forms code we are using for our Android and iOS app. Startup time on UWP is absolutely terrible. We're talking 6-15 seconds of staring at a splash screen for an empty app! I hope this can be fixed soon.

@charlesroddie
Copy link

charlesroddie commented Jul 25, 2020

@mnxamdev are you testing in release mode (i.e. with an AOT build)?

On UWP we get debug mode from 6.5 to 3.5 seconds (getting less the more you open the app), release mode 2.2s on a complex app.

The strange thing is that if we time the creation of the Xamarin.Forms.Application where all of our code is, it's 1.8s in debug mode but only 0.25s in release mode. That means release mode saves 1.5s of startup time from our code, but doesn't save any time outside of that. Does that mean that the Xamarin.Forms platform code already AOTed even in debug mode but just very slow?

@mnxamdev
Copy link

mnxamdev commented Jul 27, 2020

@mnxamdev are you testing in release mode (i.e. with an AOT build)?

@charlesroddie We are testing UWP in Release mode for x86 and x64 only. When you say AOT are you referring to the “Compile with .NET Native tool chain“ option for UWP? If not can you explain where that option is?

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@mnxamdev
Copy link

For UWP is .Net Native Toolchain compilation the problem here? So what I figured out is if I set our UWP app to Release mode for x86 or x64 and unchecked .Net Native Toolchain and our app starts around 2 seconds but with it on I get app start in 6-8 seconds. From what I understand even if we uncheck that, the store will build with .Net Native Toolchain, is that correct?
https://forums.xamarin.com/discussion/81212/upload-uwp-to-the-windows-store-without-net-native

If Xamarin isn't looking to improve the startup time on UWP, some guidance here would be good.

@charlesroddie
Copy link

@mnxamdev AOT giving slower startup times is very unusual. I understand that it's time consuming to do but I think you'll have to get a reproduction. Worth a separate issue too.

@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@trampster
Copy link

trampster commented Jun 22, 2021

We just spent some time trying to optimise the startup time of our app which uses Xamarin.Forms and the shell
Here is what we have done

  • Profiled startup tracing
  • Compiled xaml
  • Delayed most app initialization until after the UI is shown (we do nothing in App.OnStart/Activity.OnStart()
  • IoC using a custom solution that doesn't use reflection

We seem to have run out of ways to speed it up. The rest of the time is Xamarin things that we don't control.

Our startup time is 3 seconds till the UI is shown. Which honestly is not acceptable.

Are there any plans to address this?

@azrinsani
Copy link

I ended up using lazy loading from the xamarin community toolkit combined with custom AOT profile. Startup time is now 1.5s on a poco f1 phone.

@jfversluis
Copy link
Member

That is awesome @azrinsani thanks for letting us know! I think we have taken steps to make this better, and we're putting in even more effort for .NET MAUI in this area. Thanks everyone for your time and effort on this and tips to make it better. Please keep adding those. Closing this one for now as there is not much work for us more to do here right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/performance e/10:clock10: 10 feedback-ticket Issue originates from https://developercommunity.visualstudio.com help wanted We welcome community contributions to any issue, but these might be a good place to start! m/high impact ⬛ t/bug 🐛 up-for-grabs We welcome community contributions to any issue, but these might be a good place to start!
Projects
None yet
Development

No branches or pull requests

9 participants