Bug 33425 - Noticeable slowdown in NSObject creation after upgrading to 2.3.x in alpha channel
Summary: Noticeable slowdown in NSObject creation after upgrading to 2.3.x in alpha ch...
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: Master
Hardware: PC Mac OS
: High normal
Target Milestone: 2.8.0 (C7)
Assignee: Chris Hamons
Depends on:
Reported: 2015-08-27 12:05 UTC by Rodrigo Moya
Modified: 2016-05-17 18:31 UTC (History)
3 users (show)

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

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:

Description Rodrigo Moya 2015-08-27 12:05:56 UTC
In the profiler, we have a simple automated test that times the profiler UI processing a file. This morning, after upgrading the xamarin.mac package in alpha channel, we saw a 80/90% slowdown in this test, and pinpointed it to the xamarin.mac upgrade.

What the UI does in this automated test related to xamarin.mac is creating a lot of NSObject-based instances, so I created a repro case:

Create a xamarin.mac app in XS, and in AppDelegate, add:
        class MyNSObject : NSObject
        public override void DidFinishLaunching (NSNotification notification)
			for (int i = 0; i < 10000000; i++) {
				var x = new MyNSObject ();

			NSApplication.SharedApplication.Terminate (this);

more or less replicates what the profiler UI test does. And there's indeed a noticeable slowdown timing this test:

* With beta channel packages (xam.mac 2.2.x)
real    0m47.668s
user    0m48.420s
sys    0m1.463s

* With alpha channel packages (xam.mac
real    0m58.429s
user    0m56.652s
sys    0m3.365s

Ran it several times, and that 15/20% slowdown is consistent when running the test with the 2 different xam.mac versions.
Comment 1 Timothy Risi 2015-12-09 20:14:19 UTC
Tested on XM 2.0 and XM (current alpha) and this appears to no longer be the case, it took 48 seconds on both 2.0 and 2.4, so looks to have been fixed.