Am Mittwoch, den 08.03.2006, 18:33 -0600 schrieb Federico Mena Quintero: > Hi, > > I'm doing some work to improve GNOME login time. I'm starting with the > user-visible pieces first, Nautilus and gnome-panel. > > I wrote a little program to extract a timeline of Nautilus's startup > from an strace log. The first timeline is here: > > http://primates.ximian.com/~federico/news-2006-03.html#login-time-1 > > The big white gaps on the left of the chart are where Nautilus does a > time-consuming process during initialization. The bottom of the chart > is where Nautilus finally paints the desktop. > > I think it would be pretty productive if each of a few people would grab > one of these gaps, and tweak the hell out of it to make it shorter. > > I'm currently looking at improving the startup time of gnome-vfs-daemon. > I suspect that this is actually the big delay we see when activating any > bonobo server (i.e. the reason why gedit and gnome-terminal start much > slower than, say, gnome-calculator). > > Help would be much appreciated :) The attached patch ensures that we don't hardcode any pixels/icon sizes and don't lookup any stock icons during icon registration, but just add all the stock icon names we need to the factory. Measuring with a GTimer I could reduce the icon registration to rougly 1/4 of the former time, mostly because the gtk_icon_theme_lookup_icon calls are quite expensive. I don't know whether it buys us much to delay the icon size lookups until they're actually needed, but the Nautilus startup feels significantly faster with the patch applied. -- Christian Neumair <chris gnome-de org>
Index: src/nautilus-main.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-main.c,v
retrieving revision 1.151
diff -u -p -r1.151 nautilus-main.c
--- src/nautilus-main.c 15 Dec 2005 14:25:57 -0000 1.151
+++ src/nautilus-main.c 9 Mar 2006 11:10:19 -0000
@@ -132,62 +132,33 @@ static void
register_icons (void)
{
GtkIconTheme *icon_theme;
- GtkIconInfo *info;
- const char *icon;
GtkIconSource *source;
GtkIconSet *set;
GtkIconFactory *factory;
const char *icons_to_register[] = {"gnome-fs-client", "gnome-fs-network", "gnome-fs-home", "gnome-fs-trash-empty", "gnome-dev-cdrom", "stock_new-template"};
- struct { int pixel; int gtk; } sizes[] = {
- {16, GTK_ICON_SIZE_MENU},
- {18, GTK_ICON_SIZE_SMALL_TOOLBAR},
- {20, GTK_ICON_SIZE_BUTTON},
- {24, GTK_ICON_SIZE_LARGE_TOOLBAR},
- {32, GTK_ICON_SIZE_DND},
- {48, GTK_ICON_SIZE_DIALOG},
- {48, 0},
- };
- int i, j;
+ int i;
icon_theme = nautilus_icon_factory_get_icon_theme ();
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
- for (i = 0; i < G_N_ELEMENTS(icons_to_register); i++) {
+ source = gtk_icon_source_new ();
+
+ for (i = 0; i < G_N_ELEMENTS(icons_to_register); i++) {
set = gtk_icon_set_new ();
- source = gtk_icon_source_new ();
- for (j = 0; j < G_N_ELEMENTS(sizes); j++) {
- info = gtk_icon_theme_lookup_icon (icon_theme, icons_to_register[i], sizes[j].pixel, 0);
-
- if (info != NULL &&
- (sizes[j].gtk == 0 ||
- gtk_icon_info_get_base_size (info) == sizes[j].pixel)) {
- icon = gtk_icon_info_get_filename (info);
- gtk_icon_source_set_filename (source, icon);
- if (sizes[j].gtk == 0) {
- gtk_icon_source_set_size (source, 0);
- gtk_icon_source_set_size_wildcarded (source, TRUE);
- } else {
- gtk_icon_source_set_size (source, sizes[j].gtk);
- gtk_icon_source_set_size_wildcarded (source, FALSE);
- }
- gtk_icon_set_add_source (set, source);
- }
- if (info != NULL) {
- gtk_icon_info_free (info);
- }
- }
+ gtk_icon_source_set_icon_name (source, icons_to_register[i]);
+ gtk_icon_set_add_source (set, source);
- gtk_icon_source_free (source);
gtk_icon_factory_add (factory, icons_to_register[i], set);
- gtk_icon_set_unref (set);
+ gtk_icon_set_unref (set);
}
+
+ gtk_icon_source_free (source);
g_object_unref (factory);
g_object_unref (icon_theme);
-
}
/* Copied from libnautilus/nautilus-program-choosing.c; In this case,
Attachment:
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil