ListBox performance with Cocoa

I use the ListBox for smaller grid needs, but for areas where I need speed in the data grid portions of an application, I’ve always turned to the Eingugur StyleGrid. Nice control and plenty fast. But recently on the Einhugur mail list, it indicated for the StyleGrid to properly support Xojo / Retina going forward, a lot of work was going to have to be done, some of it is a rewrite, as the emailer put it. Another gotcha with 3rd party controls that has been discussed numerous times here. So I’ve started taking another look at the ListBox for Cocoa builds and Retina support.

I am finding that the keyboard cursor scrolling from row-to-row or cell-to-cell is extremely sluggish when the number of columns starts to get past 15-20. Showing more visible rows doesn’t help either. On Windows, it is blazing fast. Under Carbon, performance is not quite as fast as Windows but very good and more than acceptable, even up to 64 columns. But under Cocoa, it crawls. I’ve filed a Feedback report, #33168 (with a small, ready to run example), and I’ve talked to Tech Support, they see it too. But they mentioned they hadn’t heard about this from anyone else. I discussed this with Karen A as well. My initial thought was, maybe most people are still building mostly with Carbon? Because a ton of users use the ListBox, just type in ListBox into the forum and you get a lot of results back. Search on ListBox in the old RS forums and you get 946 pages of topics (not 946 topics, 946 pages full of topics). This is not a rarely used control. Surely if they are on Cocoa, they are seeing this.

Since Cocoa is clearly the future with Xojo on the Mac, seems like this is an issue that would affect a lot of users. Is anyone else seeing this?

You’re right. My listboxes usually only have a handful of columns, therefore I didn’t realize that yet. I filled 200 rows of a listbox with 20 columns and scrolling is very sluggish.

Addendum: This is not so with the MacOSLib Implementation of TableView. There I can scroll through a huge table with a lot of speed using a Magic Pad. Having seen this, I wonder if I should transfer my list boxes to it. It has the nicer scroll bar anyway :slight_smile:

I’m heading in the other direction, going with stuff outside of Xojo, is what got me to this spot in the first place.

I saw you message to me, but with my mouse problems i could not try your example code… I can tonight once I get hoon, assuming my problem is the trackpad… I have a pretty new beefy iMac, so if it scrolls slowly for me, it will for everybody

Try to resize a listbox with focus ring on a retina MacBook Pro : sluggish like hell.

Loaded New Mac Pro, 14r1.1, ran your demo project - yech!

And, I took it further and it’s definitely more specific to the number of columns than the number of rows.

I just tried that as well, sluggish is understatement. I can sort of live with that, turn off the focus ring and it is tolerable. But I sure hope the performance of Cocoa improves soon. At some Carbon won’t be supported, even if it is off in the distant future. And we are hurdling toward Cocoa / Retina a lot faster than some of us would like.

Oliver, after you mentioned the focus ring and the resizing, I noticed that with the focus ring turned on for the grid, the scrolling is even slower. A “Default” button at the top that is used to just fill the grid also blinks with each new cell the cursor goes to.

Just tried your example on my 27" late 2013 17 iMac with NVIDIA GeForce GTX 780M graphics card in cocoa … moving the selection with the arrow keys is a little sluggish and can lag a row or 2 if I hit the arrow key as fast as I can… I would not say it’s unusable but then again i have been using computers a long time and remember when that was not unusual. I have the screen resolution at 1600X900 (so it is easier for me to read ) so that may be minimizing the issue…

Setting teh screen resolution to 2560 X 1440… It may be a bit more sluggish. Not great… I image on a retina display it could be painful.

In Carbon no matter the resolution, this are MUCH snappier.

That said Cocoa has come a long way… It took LONG time during the cocoa betas before my listbox subclass was usable in cocoa… The cocoa listbox originally was MUCH slower in RS than now.

That said, I agree the cocoa speed needs to be improved when you have a lot of columns, but I fear they won’t want to put a lot of resources into the listbox now.

The focus ring issue has been reported before: <https://xojo.com/issue/26903>

Thanks, how many columns were you using? On my late 2013 MBP, it is usable up until about 20-25 columns after that, just looks like something is wrong with the app. I have no idea where that puts the folks that want more than 64 columns currently offered, they would be affected badly if that ever came about

Why do you say that?

Keep in mind that MacOSLib is open source and implements stuff from the Mac toolbox. It’s not the same as using a plugin.

[quote=80354:@Merv Pate]hanks, how many columns were you using? On my late 2013 MBP, it is usable up until about 20-25 columns after that, just looks like something is wrong with the app. I have no idea where that puts the folks that want more than 64 columns currently offered, they would be affected badly if that ever came about
[/quote]

Not sure if that was addressed to me, but here is how your demo looked running in the IDE (slower than a buile app I assume):
https://www.dropbox.com/s/v53t6dnzgx3uqpb/ScreenFlow.mp4

I may be wrong, but my reason for saying that was the new framework, and what Norm’s comments have implied about how the complexity of the listbox code.

I hope you are wrong too, because if the ListBox starts withering on the vine, it is time to find another tool of choice. Our products depend on grids, a lot. The ListBox looks fantastic on Cocoa / Retina…until you actually try to use it.

Thanks for posting the video, I’d be satisfied if I was getting that kind performance, looks acceptable on 50 columns. I think your strong machine / video card is covering a multitude of sins. I’ve got a 2.3 GHz i7 in my rMBP, but the video card is nothing to write home about. Maybe in a couple of years hardware will be to the point where it is not much of a concern, but right now, the Cocoa performance issues are too much of an issue.

Opps … left out that my i7 was 3.5 CHz. So both my processor and video card are more powerful. This brings up the point that maybe developing on a relatively high end machine is not always a good thing.

What i don’t understand was Tim Jones’ comment ,as he is on a new Mac Pro which should be better than my machine with more capable graphics cards.

  • Karen

I’m also facing the problem what to do with Einhugur’s DataGrid. Monkeybread Software has something called NSTableView. This has the same convoluted API as everything Cocoa. But I think this may be worth checking out. See http://www.monkeybreadsoftware.net/pluginpart-nstableview.shtml .

Using MacOS Lib or NSTable with Monkeybread, all fine. But then, for cross platform apps you have to write a separate implementation for the table UI, not good.
It would be good if Xojo fixes the speed issue before the new framework.

Never used MACOSLib, but am I correct in understanding that it contains a Listbox replacement of some kind, which performs well with retina?

That’s NSTableView which is a native Cocoa element, therefore it should do (don’t have no retina screen). It’s addressed differently than a listbox but the example is well documented. And it’s pretty fast.