Bug 57791 - iOS Device builds taking a very long time
Summary: iOS Device builds taking a very long time
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: XI 10.10 (d15-2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-06-27 13:29 UTC by tmrog
Modified: 2017-12-04 20:59 UTC (History)
7 users (show)

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


Attachments
VS Info (2.27 KB, text/rtf)
2017-06-27 13:29 UTC, tmrog
Details
Simulator build log (3.96 MB, text/rtf)
2017-06-27 13:31 UTC, tmrog
Details
Device Build Log (3.95 MB, text/rtf)
2017-06-27 13:31 UTC, tmrog
Details
VS MAC Info (2.37 KB, text/rtf)
2017-09-27 13:57 UTC, tmrog
Details
Build log for rebuild solution (3.52 MB, text/rtf)
2017-09-27 13:58 UTC, tmrog
Details

Description tmrog 2017-06-27 13:29:51 UTC
Created attachment 23136 [details]
VS Info

When I do a build for iOS Simulator the main app build takes about 16 seconds:

Time Elapsed 00:00:16.62

When I do a device build the main app build takes about 10 minutes:

Time Elapsed 00:10:02.74

I have tried using xbuild and msbuild and have gotten the same results.
Comment 1 tmrog 2017-06-27 13:31:04 UTC
Created attachment 23137 [details]
Simulator build log
Comment 2 tmrog 2017-06-27 13:31:31 UTC
Created attachment 23138 [details]
Device Build Log
Comment 3 Jeffrey Stedfast 2017-06-27 16:08:50 UTC
This is expected behavior since compiling for device requires AOTing the binaries whereas compiling for Simulator does not.

You might also be targetting multiple architectures (ARMv7 and ARM64, for examples) which also slows things down.

For simulator, you typically only build for either i386 or x86_64 and simulator builds can run .NET code w/o needing to compile to native, so lots of corners are cut for the sake of improving build times that are just not possible for device.
Comment 4 tmrog 2017-06-27 16:21:21 UTC
Yea, but 16 seconds vs. over 10 minutes?  10 minute builds are not a workable situation.  Enable device-specific builds is enabled for debug iPhone builds.
Comment 5 tmrog 2017-06-27 17:02:35 UTC
BTW...this is a new issue.  Builds did not used to take this long.
Comment 6 Zoltan Varga 2017-06-27 17:23:15 UTC
Reopened. Builds should not take 10 minutes.
Comment 7 Sebastien Pouliot 2017-06-27 18:40:36 UTC
@tmrog thanks for the logs, someone will look over them to see where time is spent and if some different options can help reduce build time.

Do you recall which older version was faster ?

Is it possible, if needed, to share your project with us to get a more accurate profile? If not then we might ask a few more questions to get more data later.

Thanks!
Comment 8 tmrog 2017-06-28 10:19:53 UTC
@Sebastien Pouliot

I first entered this bug here which has more information about when I first saw it:

https://bugzilla.xamarin.com/show_bug.cgi?id=55115

I will check to see with my client whether I can provide the project privately to you.
Comment 9 tmrog 2017-06-28 11:15:42 UTC
@Sebastien Pouliot

It will take some time to get approval to provide the project to you.  Before we go that way, I would like to provide you with whatever help you need to get to the bottom of this.

Please let me know what you need.

Ted
Comment 10 tmrog 2017-07-05 17:06:13 UTC
@Sebastien Pouliot

Sitting here waiting for my iOS build, so thought I'd check with you to see whether there is some logging or something I can enable to get more information.
Comment 11 John Miller [MSFT] 2017-09-27 12:46:17 UTC
Hi Ted,

Are you able to get approval for us to get a copy of the project to reproduce the build times locally? 

If you need to get an NDA we can provide that too.
Comment 12 tmrog 2017-09-27 13:12:17 UTC
John,

No, I will try again but I don't have much hope that they will allow me to provide the code but I will mention the NDA.

I was hoping we could proceed with "If not then we might ask a few more questions to get more data later."

Also, I have been working on a UWP app for the same project for the last couple months so I need to circle back around and time some builds with latest version of VS for MAC now that I am back working on iOS.

Ted
Comment 13 John Miller [MSFT] 2017-09-27 13:15:35 UTC
Hi Ted,

That would be excellent if you could revisit that project and collect the diagnostic logs again to share with the latest versions.

Please include your full build logs and all version information.

To get full build logs just set the log verbosity to diagnostic at the following locations:
- On Visual Studio for Mac: Preferences > Projects > Build
- On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

On Visual Studio Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

Easiest way to get exact version information:
- On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
- On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.
Then copy/paste the version information (you can use the "Copy Information" button).
Comment 14 tmrog 2017-09-27 13:56:08 UTC
John,

Here are numbers with the latest stable VS MAC.

4:00 - rebuild entire solution
3:30 - reubild main iOS project
1:45 - make single file change in main iOS project
0:30 - rebuild entire solution for simulator

These are clearly better than the +10 minute builds I was seeing before.  The question I have is whether these seem reasonable to you guys.  Still seems slow to me but I also don't understand what all the differences are building for a device vs. a simulator.

Also, wondering why the actool warnings keep popping up.

I have attached the build log for the rebuild entire solution case and version info.

Ted
Comment 15 tmrog 2017-09-27 13:57:32 UTC
Created attachment 24955 [details]
VS MAC Info
Comment 16 tmrog 2017-09-27 13:58:11 UTC
Created attachment 24956 [details]
Build log for rebuild solution
Comment 17 John Miller [MSFT] 2017-11-03 19:06:55 UTC
@tmrog,

I apologize for the delay. These build times do seem _reasonable_ to me given the complexity shown of the projects in the build log and the build settings chosen. However, it would be great to get the opinion of someone from the engineering team so I will ask for that too. 

There is good information in this guide on the build mechanics and tips and tricks for both simulator and device builds that might help answer you questions too: https://developer.xamarin.com/guides/ios/advanced_topics/ios-build-mechanics/
Comment 18 Timothy Risi 2017-12-04 20:59:05 UTC
Confirming so we can get an engineer to look at it

Note You need to log in before you can comment on or make changes to this bug.