Perfomance issue on TableView InsertRow

Hi all !!
We are using the TableView widget, and I know it’s just pre-version 0.2, but… for this very reason I would like to report something that feels like a bug (at least to me!!).

If I put 200/300 rows into a TableView, it’s pretty fast. No matter how many labels (read: colums) I have in a single row. It’s fast.

The more rows I add, the slower it gets. If I insert more than 1500 rows into the Table Views the user is gonna wait more than 10 seconds to see the final result.

Is this going to be “fixed” in the future releases?

Thank you.
[import]uid: 86439 topic_id: 27702 reply_id: 327702[/import]

Doing a quick test, each successive insert takes a little more time than the last(give or take a little depending on what else is going on in your app). So if inserting the 1000th object takes ~2ms, inserting the 1001th object can take ~2.01ms. Some of this is going to be unavoidable, since each insert has to be compared to a larger list than the previous one with regards to display groups and touch listeners, although it can probably be reduced.

For a fix on your end, do you need to insert all the objects in a single frame? Lua has both coroutines and closures, that make it pretty easy to say, insert 10 - 100 rows a frame, or insert all entries over x milliseconds, so you can avoid a big long wait, and distribute the wait per frame so it’s much less noticeable. You could also have your TableView creator register to onEnterFrame when it’s creating objects, and unregister once it’s done, using that function to continually funnel new rows into the TableView. [import]uid: 134101 topic_id: 27702 reply_id: 112374[/import]

Very well, Ntero, thank you very much for your advices.
Terrible to hear this “some of this is going to be unavoidable”… Why do you think it’s unavoidable? I mean, I clearly understand that the bigger data is the longer it takes, but a binary search into a sorted index only takes log(n) steps to find the object. So I want to believe that there is space to improve the performance.

To fix my problem I believe we are going to follow the Apple’s standard as recommended, with a more than classic “show XXXXXX more items” buttons. So we will clear the tableview and repopulate it from scratch.

[import]uid: 86439 topic_id: 27702 reply_id: 112453[/import]