Bug 42510 - Xamarin.iOS launch times are slow for basic template app
Summary: Xamarin.iOS launch times are slow for basic template app
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.8 (tvOS / C7)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-07-13 11:45 UTC by John Miller [MSFT]
Modified: 2016-07-13 13:13 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample Project (62.33 KB, application/zip)
2016-07-13 11:45 UTC, John Miller [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description John Miller [MSFT] 2016-07-13 11:45:26 UTC
Created attachment 16643 [details]
Sample Project

**Overview:**

   A customer is developing an app and noticing that the time to launch a brand new (from template) app is taking ~3 seconds to launch. Ideally, they want to hit iOS recommendations of ~300ms. Instruments shows 840ms (larger chunk of time) spent in `CFRunLoopRunSpecific`.

**Steps to Reproduce:**

   1. Attached is the template project.
   2. Deploy the app in Release mode to a device.
   3. Make sure the app is closed. 
   4. Tap the icon on the device to launch the app

**Actual Results:**

   Customer notices that the time from launch screen appearing, to first view controller is ~3 seconds.

**Expected Results:**

   Time from launch screen appearing to first view controller ~300ms

**Build Date & Platform:**

=== Xamarin Studio Enterprise ===

Version 6.1 (build 5099)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Runtime:
	Mono 4.4.0 (mono-4.4.0-branch/fcf7a6d) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404000148

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.1.99.224 (Xamarin Enterprise)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.Mac ===

Version: 2.9.2.81 (Xamarin Enterprise)

=== Xamarin.iOS ===

Version: 9.8.1.4 (Xamarin Enterprise)
Hash: 3cf8aae
Branch: c7sr0
Build date: 2016-06-20 16:09:58-0400

=== Xamarin Inspector ===

Version: 0.8.1.0
Hash: 95792d1
Branch: master
Build date: Thu May 12 22:20:04 UTC 2016

=== Build Information ===

Release ID: 601005099
Git revision: 90cd5b624ae09ab03666482981e30822caa7372e
Build date: 2016-07-01 10:03:50-04
Xamarin addins: d48fe7620678a6edeb3d23caad0b8b288a07e0c9
Build lane: monodevelop-lion-master

=== Operating System ===

Mac OS X 10.11.2

**Additional Information:**

   I was not able to reproduce this with my iPhone 6s. The customer is testing with a 5s. 
   I noticed that Debug builds take about 3 seconds given the steps to reproduce, but Release builds are much faster to launch. Release is probably at the target ~300ms.
Comment 1 John Miller [MSFT] 2016-07-13 11:48:07 UTC
Is 3 seconds reasonable for Debug builds and can this be explained as to why? 
Is there any explanation of overhead in XI for slower launch times compared to a Xcode app?
Comment 2 Sebastien Pouliot 2016-07-13 13:13:06 UTC
> Is 3 seconds reasonable for Debug builds 

yes

> and can this be explained as to why? 

yes, connecting to the debugger can easily take 2+ seconds, part of it unrelated to the device itself;

> Is there any explanation of overhead in XI for slower launch 

Debug builds are slower and larger, part of it is because this is a soft-debugger (requires extra code to be generated) and because very few optimizations (e.g. no LLVM) are enabled (to keep the build time down and because optimized builds are harder to debug).

For small application the extra mono runtime is a large part of the total application size. Application size is (a bit) related to launch time. For larger (normal) apps that's likely unnoticeable but for a template it might be measurable.



In general any performance profiling should be done with a release build using the same options that will be shipped to customers (enabling LLVM is much encouraged);

Also make sure:

* the managed linker is enabled (it's default but you can double-check). Otherwise it's much larger (load time) and every unused type will need to be registered;

* that the option for using the dynamic registrar is off (default for device) as this requires additional time at startup for registering types;