Hi, On Mon, 2007-03-26 at 19:06 -0600, Federico Mena Quintero wrote: I was looking at the GtkTreeView code and it looks like there are other > places that could get the array treatment. One place in particular was > the sorting machinery... GtkListStore also uses a GList of information > for the sort headers, and walks the list in g_list_store_compare_func > (!). >
Using arrays in GtkTreeDataSortHeader doesn't appear to be optimal, because their length is not constant. We would end up to alloc/dealloc/copy sequence when adding new items. They are also accessed according to sort_id (which can come from application program and are not neccesarily contiguous). This means that if we would have an ordered vector we could reach O(log n) search time. Yes, it's better than current O(n) one. However, why this step is needed at all for each comparisison!! It's certainly the case that there will be more sort function calls than changes to sort criteria. This would allow us to cache the pointer to active GtkTreeDataSortHeader directly, providing us constant time O(1) access. Or did I miss something? -Markku- _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-devel-list