Re: Very slow NSTableView
Re: Very slow NSTableView
- Subject: Re: Very slow NSTableView
- From: Graham Cox <email@hidden>
- Date: Tue, 4 Jul 2017 18:02:52 +1000
> On 4 Jul 2017, at 5:39 pm, Quincey Morris
> <email@hidden> wrote:
>
> On Jul 4, 2017, at 00:18 , Graham Cox <email@hidden> wrote:
>>
>> Is there a way to opt-out of vibrancy for an entire table view?
>
> There’s no clear indication that the performance problem has anything to do
> with vibrancy.
True, but the -[NSCell _endVibrantBlendGroup] might suggest it - though it
seems to just call through to CGContextEndTransparencyLayer, which is where the
time is spent (my understanding is that CGLayers buffer drawing using a
temporary bitmap).
So, turning vibrancy on/off in system prefs has no effect.
Next, I subclassed the NSTableView to return NO from -allowsVibrancy. It works
- no more nasty desktop bleedthrough, but it still scrolls very slowly.
> In both cases, the “expensive” call was about transparency, which could just
> be about compositing view with transparent backgrounds. I’m wondering if
> there are views that you can make opaque by specifying solid background
> colors.
The views this is part of are all opaque - in many cases returning YES from
-isOpaque on purpose, as well as painting their backgrounds with solid colours.
> Also check whether the table or cell views is marked as “layer backed” (in
> the last tab of the inspector). I’ve noticed that in recent Xcodes, the top
> level view of new projects seems to have this checked by default. It may be
> that your older project *doesn’t* have this set, and it’s important to set it
> for recent macOS versions, or (conversely) you do have this set and it’s not
> a good idea.
Aha… that certainly made a difference.
It was not layer-backed, but turning on layer backing for just the top-level
view that is hosting the scroller+table view does seem to allow it to work
smoothly.
>
> OTOH, if the problem is related to vibrancy, compositing or transparency,
> it’s hard to believe that this could/should slow things down so dramatically.
> Can you try running the app with the popup menus removed temporarily, and see
> what difference that makes? There might be some justification for a bug
> report.
>
Removing the pop-up buttons temporarily also speeds things up quite a bit,
though not as dramatically as the layer backing.
I can live with layer-backing as a solution, it doesn’t appear to have any
downsides. Obviously code internal to these views is now assuming it’s there.
Is NSTableView documented anywhere to require layer backing?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden