Re: (no subject) (? tree view becomes slow ?)



On Monday August 18 2003 14:05 CEST, emafranc libero it wrote:
    
I'm developing an application (using gtk+ 2.2.2) that
requires more than 2000 columns in a list (treview).
    
Don't know anything about your app but: do you really need so
much columns? I'm working on a similar tree view for hard
disc browsing and sometimes there are folders with over 1000
files (e.g. /usr/bin). But i don't need 1000 columns for that.
My tree view only has one column with one iterator and the
rest is done with child iterators. But no more columns.
    
Inserting columns becomes more and more slow depending on
the number of columns in the view. I tried searching for
solutions over the Internet, but I failed.
    
I'm not shure if this will be faster by using only one column.
But it should take a bit less of space in memory. And it's
generally a good idea to have least objects as possible.
    
I assume you are doing the generation of your tree/list view
in a loop. This is often the case for slowing down some
processes. Some weeks ago i wrote a loop that reads in a
directory and sorts the entrys to alphabetical order. Worked
great for little folders. But for folders with 800 entrys and
more the loop needed more than 5 seconds. That's not very
good to get happy users of my app.
    
I fixed this by setting a 'printf(counter)'. Output shows me
that the code inside of loop was done more than 500.000 times.
And this for less than 1000 entries?
    
Cause the entrys are to order alphabetcal the loop needs more
than 1000 runs (each letter of entry needs to be checked). I
can't explain all details now. But a loop like this can be
great or bad. I made extensive changes for that loop and now
the code inside loop is done 200.000 times instead of 500.000.
And cuase i fixed some more loops inside this loop i get an
function that is able to read and sort 1000 folder entrys in
less than 1 second.
    
You can see that it is a question of optimizing. In C you can
develop all thinkable things. But sometimes you need to do this
with care and with target to have fast/short loops and not to
use more memory/functions than necessary.
    
mathew
    
-- 
             ______________________________________________
                    get free software:  www.matman24.org
             ______________________________________________



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