[evolution-patches] etree performance patch
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: [evolution-patches] etree performance patch
- Date: Wed, 08 Jun 2005 12:14:16 +0800
Finally tracked down the performance issue I was trying to track down.
What a pain.
Anyway basically the problem is that every time the cursor moves, it
comes through as a 'selection has changed' event, so the etable just
redraws itself entirely, since it doesn't separately track what state it
last drew the items in.
The select model already has events for 'this row has changed', they
just weren't ever emitted, so this patch makes it emit row-by-row events
if only a few rows have changed.
It could probably just do it for every row anyway, or the rendering code
could track state, but I think i don't care enough.
This makes a fairly big difference to moving the cursor if you dont show
the message pane (although it still doesn't keep up with the key
presses, if you have a long list! i think something else is causing
that now).
This is against gal pre-move.
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.949
diff -u -p -r1.949 ChangeLog
--- gal/e-table/ChangeLog 20 May 2005 02:21:28 -0000 1.949
+++ gal/e-table/ChangeLog 8 Jun 2005 04:04:29 -0000
@@ -1,3 +1,10 @@
+2005-06-08 Not Zed <NotZed Ximian com>
+
+ * e-tree-selection-model.c (etsm_toggle_single_row)
+ (etsm_select_single_row): If only a few rows have changed, emit
+ each as a separate row_changed event rather than triggering a
+ complete redraw of the whole window.
+
2005-05-20 Li Yuan <li yuan sun com>
* e-table-header-item.c:
Index: gal/e-table/e-tree-selection-model.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-tree-selection-model.c,v
retrieving revision 1.49
diff -u -p -r1.49 e-tree-selection-model.c
--- gal/e-table/e-tree-selection-model.c 29 Apr 2005 14:16:04 -0000 1.49
+++ gal/e-table/e-tree-selection-model.c 8 Jun 2005 04:04:29 -0000
@@ -573,16 +573,44 @@ etsm_cursor_col (ESelectionModel *select
}
static void
+etsm_get_rows(int row, void *d)
+{
+ int **rowp = d;
+
+ **rowp = row;
+ (*rowp)++;
+}
+
+static void
etsm_select_single_row (ESelectionModel *selection, gint row)
{
ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
+ int rows[5], *rowp = NULL, size;
g_return_if_fail (path != NULL);
+ /* we really only care about the size=1 case (cursor changed),
+ but this doesn't cost much */
+ size = g_hash_table_size(etsm->priv->paths);
+ if (size > 0 && size <= 5) {
+ rowp = rows;
+ etsm_foreach(selection, etsm_get_rows, &rowp);
+ }
+
select_single_path (etsm, path);
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
+ if (size>5) {
+ e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
+ } else {
+ if (rowp) {
+ int *p = rows;
+
+ while (p<rowp)
+ e_selection_model_selection_row_changed((ESelectionModel *)etsm, *p++);
+ }
+ e_selection_model_selection_row_changed((ESelectionModel *)etsm, row);
+ }
}
static void
@@ -599,7 +627,8 @@ etsm_toggle_single_row (ESelectionModel
g_hash_table_insert (etsm->priv->paths, path, path);
etsm->priv->start_path = NULL;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
+
+ e_selection_model_selection_row_changed((ESelectionModel *)etsm, row);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]