Message-ID: <423167AC.5060900 at wanadoo.fr> Disposition-Notification-To: Arnold Date: Fri, 11 Mar 2005 17:41:00 +0800 From: Arnold MIME-Version: 1.0 To: Richard Jones CC: lablgtk at math.nagoya-u.ac.jp Subject: Re: Inserting rows into GTree.tree_store is slow References: <20050311003216.GA31634 at furbychan.cocan.org> In-Reply-To: <20050311003216.GA31634 at furbychan.cocan.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 > tree_store? > > Rich. > Inserting a lot of rows is quite slow if a #GTree.model is "attached" to a GTree.View. 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. http://scentric.net/tutorial/sec-treemodel-add-rows.html#sec-treestore-adding-many-rows I hope it helps you.