Inserting rows into GTree.tree_store is slow
arnold.guillaumot at wanadoo.fr
Fri Mar 11 10:41:00 CET 2005
Richard Jones wrote:
> I have a program which loads a file and inserts around 25,000 rows
> into a GTree.tree_store model. This process takes about 10 minutes.
> I had initially blamed the (OCaml-based) loading and parsing code, but
> now that I come to analyse it, it turns out that the OCaml code is
> almost instantaneous (no suprise there!) but inserting the rows into
> the GTree.tree_store is what is taking all the time.
> I'm wondering if there is a particular reason for this. Is it just
> that the underlying C model is slow, or could it be the OCaml
> bindings? Are there good ways to "bulk insert" lots of rows into a
Inserting a lot of rows is quite slow if a #GTree.model is "attached" to
You have first to call the method view#unset_model () from your GTree.view.
Then once heavy operations are finished call the view#set_model model to
display your data.
You can also refer to the the tutorial written by Tim-Philipp Muller.
I hope it helps you.
More information about the Lablgtk-list