Forum Xamarin.Mac

NSOutlineView ExpandItem performance

VioletaSanchezVioletaSanchez ESMember ✭✭


I have a NSOutlineView with an expandable item with 250000 children.
When clicking the disclosure arrow to expand the item, the gui hangs for about 9secs.
Is there is a way to improve/fix that time?

I tried to check where the time goes but I didn’t find most of the time.

ExpandItem for the item with 250000 children takes 8795ms.

This method calls internally:

  • NSOutlineViewDataSource - public override nint GetChildrenCount(NSOutlineView outlineView, NSObject item) - It’s called only once and it takes no time.
  • NSOutlineViewDataSource - public override NSObject GetChild(NSOutlineView outlineView, nint childIndex, NSObject item) - It’s called 250000 times, all calls take 987ms.
  • NSOutlineViewDelegate - public override nfloat GetRowHeight(NSOutlineView outlineView, NSObject item) - It’s called 250000 times, all calls take 7ms.
  • NSOutlineViewDelegate - public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item) - It’s called 154 times, all calls take 491ms.

So, I don't know where most of the time goes :( Anything else I could look into it?

Thanks in advance



  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    I suspect a vast majority of this time is in Cocoa, sorting through that massive number of items.

    That is an order of magnitude more items that I thought could be put in an NSOutlineView to be honest.

    It should be easy to write simple ObjC or Swift sample, add that many children to it, and see if behaviors similarly. I strongly suspect it will.

Sign In or Register to comment.