brendand / mbtablegrid

An NSControl subclass which provides a spreadsheet-style table grid
9 stars 3 forks source link

Where can I get a quick overview of this library? #29

Open cognociente opened 9 years ago

cognociente commented 9 years ago

Hi Brendan

I've developed a grid of my own based on NSViews and not NSCells per Apple's recommendation. The performance hasn't been great and I'm looking at alternatives hence my desire to understand your code and perhaps contribute.

I intend to start looking at the code but would appreciate a short overview and any hints on what to concentrate on so that navigation is easier. Also, I would be interested in the differences between this library and LIGridControl (which appears similar on the surface)

Kind Regards

Sam Isaacson ...a Swift Developer!

brendand commented 9 years ago

I was looking at LIGridControl at one point, but I decided not to use it. However, I can't remember why :-)

The problem with NSViews in a table view is the performance is terrible when dealing with a spreadsheet like control. With NSCells you really only have one cell per column and you just put the data in each cell as you go. With NSViews there's cell re-use, but you end up instantiating tons of different views. For me, memory consumption was HUGE using an NSView based NSTableView. I haven't yet used MBTableGrid in my own app because it needs a few more features before I can commit to it. But that's why I've been working on it slowly. If you can contribute to it, that would be great. I am hoping to have someone else contribute to the project soon as well.

To see how it works, just download the project and play around with the demo app. The last thing I was working on was a summary row. I hadn't completed it yet though, so it's not very useful at the moment. You should be able to put any kind of cell into the summary row. Take a look at the various issues I created and pick something to work on. That would be very much appreciated.

Brendan

cognociente commented 9 years ago

I would be interested to know at what Grid Sizes your NSView based tableGrid became unmanageable from a performance point of view.

Could this control cope with being created directly with 16k columns x 1m rows (equivalent to an Excel spreadsheet). In some basic tests I did in the demo app it was struggling to cope with grid sizes much lower than this - perhaps I'm doing something wrong though? Important note on the aforementioned: this was done on the original version of this github repository of matball - in trying to get to grips with the library code I thought it best to first look at the simplest/smallest version first.

brendand commented 9 years ago

The problem I had with my view based NSTableView was the amount of memory it required. In some of my tests it was just sucking up the memory. Now, that may have been due to a bug in my code, but as soon as I switched to an NSCell based NSTableView, memory consumption and thus performance was much better.

I haven't done a test with 16,000 columns and 1 million rows. I don't think my customers would ever need such an ability, but I'm sure there's room for many optimizations in order to achieve something like that. there were some performance optimizations I made to this control since the original Matt Ball version.