[Gtk-sharp-list] PATCH: speed up treeview and managed values

Ben Maurer bmaurer@users.sourceforge.net
Sun, 15 Feb 2004 01:05:12 -0500


In MonoDevelop, I was finding that we were having problems loading a
large treeview. The issue was that set a sort function that required the
accessing of values from the TreeStore. It turns out that the cost of
accessing a value is quite high.

These two patches reduce the cost by quite a bit, over 50%. Also, the
memory allocation is way down.

The first one implements ManagedValue using GCHandles. The bulk of this
code is now implemented in C to avoid some overhead (before, we were
accessing a hashtable by an intptr which caused boxing). Also, this
avoids the cost of invoking a C# delegate from C.

The second patch avoids the allocation of Glib.Value's by implementing
the code in C where the values are stored on the stack.

The patch is at:

Overall, this made a noticable difference when loading a large project
(in this case, the MCS compiler) in MonoDevelop. The time improved and
memory was down by a few MB (according to top).

-- Ben