Gtk.TreeModel._convert_value() has a huge performance cost
Submitted by Martin Pitt
Link to original bug (#694857)
Description
While debugging bug 693402 I noticed that our _convert_value() magic for List/TreeStore has a rather large performance penalty.
Doing this:
st = Gtk.ListStore(*[str]*5)
for r in range(10000):
st.append(['Aaaaaaa', 'Bbbbbbb', 'Ccccccc', 'Ddddddd', 'Eeeeeee'])
takes about 5 seconds on my machine. When short-circuiting _convert_value() to just return the input value, it takes about half a second only.
As pygobject marshals native types into GValues itself, and much more efficiently, we should only construct GObject.Values from Python in the corner cases where it matters, e. g. for derived int types.