Bug 57277 - Slow XAML compile times
Summary: Slow XAML compile times
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Stephane Delcroix
Depends on:
Reported: 2017-06-08 15:53 UTC by Devan Stormont
Modified: 2017-06-28 08:01 UTC (History)
3 users (show)

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

Sample large XAML file that takes 5-6 seconds to compile by itself (27.41 KB, application/xml)
2017-06-08 15:53 UTC, Devan Stormont

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 for Bug 57277 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Devan Stormont 2017-06-08 15:53:46 UTC
Created attachment 22779 [details]
Sample large XAML file that takes 5-6 seconds to compile by itself

The core XamlC task runs unusually slowly on larger files (>10 KB typically demonstrates the slowness). On a project with ~120 XAML files, this can easily lead to over a minute of XamlC task time (compared to <10s combined for all other build tasks). Updating from XF 2.3.3/Mono 4.8 to XF 2.3.4/Mono 5 improves the speed somewhat, but the compile times are still significantly slower compared to other projects that contain no XAML.


I discussed the issue with Stephane Delcroix at Xamarin and this was his response:

"On this 4yo machine (mbp13, 2013) I get consistent results with what you report: the project takes 1m01 to build.
Updating to xf 2.3.4 and mono>5, the same projects builds in 27s, of which 21s are for XamlC. I get a good uniformity in results. Changing the log verbosity or building in Release mode doesn’t skim much time (a bit more than a sec in Release vs Debug).
I then instrumented XamlC to get finer results.
1/ Assembly loading, assembly writing: around 600ms for writing, not measured reading. I’m fine with that given the size of the assembly
2/ Parsing times: 2ms for the biggest files. Could be better, maybe, but I’m fine with those results
3/ the core of XamlC takes up to 700ms for a handful of files in your solution. There’s probably something we can work on there.
I’ve looked again at your Xaml, there’s no visible abuse, and I don’t have any advice to reduce the build time for those at this time."