-
Notifications
You must be signed in to change notification settings - Fork 528
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
Xamarin.Android app starts up slower when built using VS2019 #3366
Comments
Try to set |
Also try VS 16.2 previews if possible. We did some performance improvements in 16.2. |
Thanks for responding. I have used those two suggestions and made some new timings. I also did equivalent timings with AOT turned off, which makes an interesting comparison. The takeout for AOT is that by not pre-loading the assemblies you save a few milliseconds and by using VS 2019 16.2 Preview you save a few milliseconds more and bring the results pretty much back in line with VS 2017. With AOT turned off, the time savings are fairly significant just by moving to VS 2019, with more time savings gained by not pre-loading assemblies and using 16.2 Preview (similar to the incremental savings with AOT turned on). Do we know why having AOT turned on means there are no time gains compared to having it turned off? AOT OnSamsung Galaxy S7VS2017 420ms Samsung Galaxy S9VS2017 380ms AOT OffSamsung Galaxy S7VS2017 730ms Samsung Galaxy S9VS2017 630ms |
@bellissimo AOT might be slower because of the generated |
Looks like they contain text relocations:
We should probably change that in future. It might gain us few more ms. |
I noticed similar problem, when I build Xamarin.Forms Android platform release using App Center, the startup time with SDK Xamarin.Android 9.4 (Mono 6.0) is much worst than Xamarin.Android 9.3 (Mono 5.18). I did some tests today with AOT enabled and disabled, and data looks strange. It seems that with 9.4 startup time with AOT and without AOT is almost same and about 100% more than 9.3 AOT version. |
Changes: mono/mono@2c3aeaf...7af64d1 Upstream-Fixes: mono/mono#16369 Fixes? #3366
Changes: mono/mono@2c3aeaf...7af64d1 Upstream-Fixes: mono/mono#16369 Fixes? #3366 Context: #3579
I followed similar test steps as mentioned above to test this across a few XA releases and old/budget devices:
Results*The asterisk on the d16-4 AOT results indicate that this .apk was built on macOS. All other cases were built and deployed on Windows, however #3619 is currently blocking AOT usage on Windows in recent builds. |
Changes: mono/mono@29b1ac1...cecda47 Context: mono/mono#16486 Context: #3366 Bumps to mono/corefx@e79cf5b. Adds `aprofutil.exe`, a utility for parsing `.aotprofile` files. See also a3fb59a. (`aotprofile-tool` was renamed to `aprofutil`). Introduces a different fix to prevent .text relocations in AOT output while removing the previous implicit assembly size limit.
Changes: mono/mono@29b1ac1...cecda47 Context: mono/mono#16486 Context: #3366 Bumps to mono/corefx@e79cf5b. Adds `aprofutil.exe`, a utility for parsing `.aotprofile` files. See also a3fb59a. (`aotprofile-tool` was renamed to `aprofutil`). Introduces a different fix to prevent .text relocations in AOT output while removing the previous implicit assembly size limit.
This is likely much better nowadays with the extensive performance work we've done over the past 2 years: Even though it says MAUI, many changes were made in XA which will improve all XA app performance. |
I am currently using VS2017, but when I tried my app using VS2019 I noticed that the startup time was significantly slower (ca. 20% slower). I measured the startup times on real devices by checking the 'Displayed' logging line that Android provides to show that the main activity is shown.
This scenario is when 'AOT' is turned on (I also turned on LLVM, but this had little effect on timings whether it was on or off).
I thought I would try out a template Xamarin.Android app to rule out any app specific issue, so I created the 'Tabbed' app template (so that it would have a reasonable number of libs). I then tested startup times (averaging across 10 startups) on two devices. Each time I switched between VS2017 and VS2019 I did a 'Clean' and also deleted the 'obj' folder for good measure.
Any comments or suggestions to progress this further would be welcome. Given that Google are tending to punish slow starting apps more severely in the rankings, this is currently stopping me upgrading to VS2019.
Below were my startup timings:
Samsung Galaxy S7
VS2017 - 420ms
VS2019 - 470ms
Samsung Galaxy S9
VS2017 - 380ms
VS2019 - 440ms
Steps to Reproduce
<AotAssemblies>true</AotAssemblies>
<EnableLLVM>true</EnableLLVM>
<AndroidEnablePreloadAssemblies>true</AndroidEnablePreloadAssemblies>
Expected Behavior
Given the improvements made to startup times in VS2019, the startup time should be quicker in VS2019, or at least equivalent to VS2017.
Actual Behavior
Startup time is approx. 10-20% slower when built using VS2019
Version Information
VS2019
Microsoft Visual Studio Professional 2019
Version 16.1.6
VisualStudio.16.Release/16.1.6+29102.190
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Professional
Azure App Service Tools v3.0.0 16.1.429.50124
Azure App Service Tools v3.0.0
C# Tools 3.1.1-beta4-19281-06+58a4b1e79aea28115e66b06f850c83a3f1fcb6d3
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.1.77 (master@24013d5)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Mono Debugging for Visual Studio 16.1.1 (2473f22)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.1.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
Visual Basic Tools 3.1.1-beta4-19281-06+58a4b1e79aea28115e66b06f850c83a3f1fcb6d3
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.4 for F# 4.6 16.1.0-beta.19253.3+42526fe359672a05fd562dc16a91a43d0fe047a7
Microsoft Visual F# Tools 10.4 for F# 4.6
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 16.1.0.545 (d16-1@db7c858e8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.1.0.418 (remotes/origin/d16-1@5b958bb10)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.2.112 (4db4af4)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 9.3.0.23 (HEAD/d0b48056f)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@3a07bd426d3
Java.Interop: xamarin/java.interop/d16-1@5ddc3e3
LibZipSharp: grendello/LibZipSharp/d16-1@44de300
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-1@acabd26
Xamarin.iOS and Xamarin.Mac SDK 12.10.0.157 (6bd9475)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
VS2017
Microsoft Visual Studio Professional 2017
Version 15.9.8
VisualStudio.15.Release/15.9.8+28307.481
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Professional
Visual C++ 2017 00369-60000-00001-AA801
Microsoft Visual C++ 2017
Application Insights Tools for Visual Studio Package 8.14.20131.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.
Azure App Service Tools v3.0.0 15.9.03024.0
Azure App Service Tools v3.0.0
C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JavaScript UWP Project System 2.0
JavaScript UWP Project System
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
MLGen Package Extension 1.0
MLGen Package Visual Studio Extension Detailed Info
Mono Debugging for Visual Studio 4.13.12-pre (9bc9548)
Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.4.21001.1 Commit Hash:8dd15923800d931b153ab9e4de74e42a74eba5e6
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
SQL Server Data Tools 15.1.61902.21100
Microsoft SQL Server Data Tools
TypeScript Tools 15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
Microsoft Visual F# Tools 10.2 for F# 4.5
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
Visual Studio Tools for Universal Windows Apps 15.0.28307.421
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 4.12.3.80 (d15-9@914127c74)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 4.16.13 (45a16efd4)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 1.1.128 (6f5ebb2)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 9.1.7.0 (HEAD/ba9da7a76)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 12.2.1.15 (d60abd1)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
The text was updated successfully, but these errors were encountered: