Re: Speed of GtkListStore additions O(n^2)?



On 3 Jun 2003, Owen Taylor wrote:

>  - Insertion into a *sorted* GtkListStore is O(n^2). Delaying turning
>    on sorting until after the list store is filled will allow GTK+
>    to use more efficient sorting algorithms.

Yep Owen you're right as always. Delaying
gtk_tree_sortable_set_sort_column_id() until after the values are filled
in solves the problem. The first time. (Thanks a bunch for pointing this
out.)

Then I happen to need to blank the store and refill it repeatedly. And
there doesn't seem to be a good way to turn sorting _off_ once you turned
it on, so any subsequent fills will be O(n^2) anyway.

Any suggestions? Or will I simply have to destroy the ListStore (and thus
the ListView) and create a new one each time I want to do something like
this?

Linus Walleij




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]