[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: gtktreeview sooo slow



Mohammed Sameer wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> The tree view is soo slow when adding large ammount of data, Is there a way to improve the speed ??
> attached the code, Can anyone have a look and point me plz ?

I can give you a few reasons, and a few suggestions.  Firstly, fetching 
from mysql is probably a fair amount of the speed problem.  Combine that 
with TreeView's general suckiness its going to be pretty darn slow.  As 
for fixing it, I can suggest a few things.  You could fetch the data 
from mysql in a different thread, and when it is all available (I can't 
tell/remember if you're using the fetch-all-at-once or the 
fetch-incrementally mysql commands) feed it to the Model.  You could 
fetch the data incrementally and see if that fixes things.  You could 
not use mysql, but rather something with a bit more speed.  More 
specifically, you could store the length,genre,volume,mode and track as 
numerical values, rather than character arrays.  You could do something 
like this:

{
guint i = 0;

while (fetch row) {
	if (++i == 30) {
		while (gtk_events_pending()) {
			gtk_main_iteration();
		}
	}

	add row to list store
}

I've found that appears to speed things up a bit (and it may be just 
that, appears to)

Past that, I'd say deal with it *grin*

-- 
-charlie




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]