Leandro Lucarella | 10 Jul 01:53 2010
Picon

Re: gtkpod 1.0 beta 2

Leandro Lucarella, el  9 de julio a las 18:42 me escribiste:
> I tried to break tm_add_track_to_track_model() using GDB to see how long
> took each song to be scanned and it seems to be instantly really, so
> I guess there is something else going on.

I'm doing some profiling and, correct me if I'm wrong, but gtkpod load
all the songs at the beginning of the program, and not each time one
clicks on the iPod playlist, so I that is correct, an I/O problem
involving the device is discarded. It looks like it's GTK which somehow
is slow. Manipulating the TreeViews seems to be what's taking so long.

I've compiled gtkpod setting the macro DEBUG_TIMING and added a couple
more prints and this is the result:

pm_selection_changed_cb enter: 2098.201221 sec
pm_selection_changed_cb before listing: 2098.214338 sec
pm_selection_changed_cb after listing: 2150.997785 sec
pm_selection_changed_cb exit:  2151.172406 sec
st_selection_changed_cb enter (inst: 0): 2151.504683 sec
st_selection_changed_cb after st_init: 2178.739254 sec
st_selection_changed_cb before loading tracks: 2178.739273 sec
st_selection_changed_cb after loading tracks: 2232.149276 sec
st_selection_changed_cb exit:  2232.376281 sec
st_selection_changed_cb enter (inst: 1): 2232.376300 sec
st_selection_changed_cb after st_init: 2260.392100 sec
st_selection_changed_cb before loading tracks: 2260.392119 sec
st_selection_changed_cb after loading tracks: 2315.961767 sec
st_selection_changed_cb exit:  2316.018309 sec
st_selection_changed_cb enter (inst: 1): 2316.116774 sec
st_selection_changed_cb after st_init: 2343.740650 sec
st_selection_changed_cb before loading tracks: 2343.740677 sec
st_selection_changed_cb after loading tracks: 2399.858041 sec
st_selection_changed_cb exit:  2399.920906 sec
st_selection_changed_cb enter (inst: 1): 2399.920933 sec
st_selection_changed_cb after st_init: 2428.241284 sec
st_selection_changed_cb before loading tracks: 2428.241303 sec
st_selection_changed_cb after loading tracks: 2483.904216 sec
st_selection_changed_cb exit:  2483.962219 sec

The after and before listing/loading tracks was added like this:
#if DEBUG_TIMING
                    g_get_current_time (&time);
                    printf ("pm_selection_changed_cb before listing: %ld.%06ld sec\n",
                            time.tv_sec % 3600, time.tv_usec);
#endif
                    for (gl=new_playlist->members; gl; gl=gl->next)
                    {
                        /* add all tracks to sort tab 0 */
                        Track *track = gl->data;
                        st_add_track (track, FALSE, TRUE, 0);
                    }
#if DEBUG_TIMING
                    g_get_current_time (&time);
                    printf ("pm_selection_changed_cb after listing: %ld.%06ld sec\n",
                            time.tv_sec % 3600, time.tv_usec);
#endif

iAt display_playlists.c:1518 and:

#if DEBUG_TIMING || DEBUG_CB_INIT
            g_get_current_time (&time);
            printf ("st_selection_changed_cb before loading tracks: %ld.%06ld sec\n",
                    time.tv_sec % 3600, time.tv_usec);
#endif
            for (gl = new_entry->members; gl; gl = gl->next) { /* add all member tracks to next instance */
                Track *track = gl->data;
                st_add_track(track, FALSE, TRUE, inst+1);
            }
#if DEBUG_TIMING || DEBUG_CB_INIT
            g_get_current_time (&time);
            printf ("st_selection_changed_cb after loading tracks: %ld.%06ld sec\n",
                    time.tv_sec % 3600, time.tv_usec);
#endif

(at display_sorttabs.c:~1930)

"the after st_init()" was added after any st_init() call in
st_selection_changed_cb().

pm_selection_changed_cb() and st_selection_changed_cb() are both taking
an eternity, and both apparently because of the TreeView manipulation.
Besides that being too slow, I don't know why those callbacks are called
so many times, since only one click on the iPod playlist triggered all
that callbacks (which makes things even worse).

I have no idea why this is happening though, all I can say is that I'm
using other GTK applications that make heavy use of TreeView; like gmpc,
where I can list about 25k songs (much more than I have in the iPod) in
a fraction of a second. To makes things worse, libgtk-2.0 is the same
version in the Ubuntu box where it's slow than in the box where it works
fine (which BTW is a Pentium M 1.7GHz, much less processing power than
the box where it's incredibly slow).

Any ideas or suggestions are welcome.

--

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Y tuve amores, que fue uno sólo
El que me dejó de a pie y me enseñó todo...

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Gtkpod-questions mailing list
Gtkpod-questions <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-questions

Gmane