[NOTE: I just realized that my tree is patched with the multi-threaded thumbnail loaders patch. I'm not sure what this may have changed.]

So, the vast majority of the time is spent in:
static void vflist_name_cell_data_cb(...)
which lives around line 1771 of view_file_list.c

The backtrace generally looks something like:
#0  0x00007fa6702496d4 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#1 0x00000000004bc950 in vflist_name_cell_data_cb (tree_column=0x103d260, cell=0xf12c90, tree_model=0x1031880,
    iter=0x7fff69fbbed0, data=0xe7f980) at view_file_list.c:1780
#2 0x00007fa67026a2f3 in gtk_tree_view_column_cell_set_cell_data () from /usr/lib/libgtk-x11-2.0.so.0
#3  0x00007fa670262226 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#4  0x00007fa670262b31 in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#5  0x00007fa670262eab in ?? () from /usr/lib/libgtk-x11-2.0.so.0
#6  0x00007fa66fdaff6b in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#7  0x00007fa66e034e4a in g_main_context_dispatch () from 
/usr/lib/libglib-2.0.so.0
#8  0x00007fa66e038510 in ?? () from /usr/lib/libglib-2.0.so.0
#9  0x00007fa66e0389dd in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#10 0x00007fa670168727 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#11 0x0000000000475b28 in main (argc=1, argv=0x7fff69fbc338) at main.c:899


I added some profiling code against r1796 and then wrote some one-liners to analyze it. Basically, it looks like vflist_name_cell_data_cb is being called approx. once per file. It generally takes <=3 msecs to run. It seems unlikely that we can optimize this a whole lot.

The main problem is that we don't get to render until all these calls finish. That is, even though the UI stays responsive, no rendering happens. I forget what the function is, but we probably need to periodically call the function that checks if there are pending tasks to be done. We could live with calling it once every 1000 iterations of vflist_name_cell_data_cb without too much of a performance hit, I imagine.

Anyway, here's some data. All times are in msecs. This was in a directory with 46,000 NEFs (well, symlinks to NEFs). The results were pretty stable.

Histogram for time spent outside of vflist_name_cell_data_cb():
time:   count
0:      38192
1:      8273
2:      40
3:      13
4:      6
5:      9
7:      16
8:      4

This is 9.054 seconds

Histogram for time spent inside of vflist_name_cell_data_cb():
time:   count
0:      12815
1:      18616
2:      14413
3:      561
4:      27
5:      9
6:      5
7:      10
8:      27
9:      35

This is 50.808 seconds

So for 59.862 seconds, the UI is responsive, but no rendering happens. This is entirely CPU-bound — no I/O or memory allocation seems to happen during this period.

--xsdg

/* USAGE:
 * "use" is actually related to the precision.  It should be a power of 10,
 *      between 1 and 1000000, inclusive.  The whole seconds are multiplied
 *      by this value, and then the partial seconds are added in beneath, so
 *      1 will give you 1-second precision (that is, 1/1sec = 1 second)
 *      1000 will give you 1-msec precision (1/1000sec = 1 millisecond)
 *      1000000 will give you 1-usec precision (1/1000000sec = 1 microsecond)
 *      Note that the accuracy may not be as tight as the precision.
 *
 * call rstime(use) to reset the timer
 * call gotime("some tag", use) to measure how long it's been since the last
 *      call and print the interval length
 */

#define rstime(use) timestuff("", use, 1)
#define gotime(tag, use) timestuff(tag, use, 0)
static void timestuff(const char **tag, int use, int reset)
{
    static struct timeval curtime;
    static struct timeval prevtime;
    static long long diff;
    static int ratio = 1000000;
    
    gettimeofday(&curtime, NULL);
    if(reset == 0)
    {
        diff = ((long long) curtime.tv_sec * use + curtime.tv_usec / (ratio / use)) -
               ((long long) prevtime.tv_sec * use + prevtime.tv_usec / (ratio / use));
        printf("time diff %s: %ld\n", tag, diff);
        }
    
    prevtime.tv_sec = curtime.tv_sec;
    prevtime.tv_usec = curtime.tv_usec;
    }
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel

Reply via email to