[Nautilus-list] EEL patch



Eel is doing loads of g_file_exists() showing up in my profiles. It seems
to be mostly when looking for the default font.

Here is a patch that fixes it.

With this patch and the Bobobo UI handler patch I posted in
gnome-components-list i got a 20% speedup. The three main performance
problems on open new window are now:
1. A *lot* of calls to malloc/free
2. the regexp kernel doing mimetype matching in gnome-vfs
3. genrand_dev in ORBit generating random data when activating objects.

/ Alex

Index: eel/eel-font-manager.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-font-manager.c,v
retrieving revision 1.12
diff -u -p -r1.12 eel-font-manager.c
--- eel/eel-font-manager.c	2001/06/06 22:08:04	1.12
+++ eel/eel-font-manager.c	2001/06/26 15:06:44
@@ -1221,10 +1221,15 @@ eel_font_manager_get_default_font (void)
 		DEFAULT_FONT_DIRECTORY "/" DEFAULT_FONT,
 		SOURCE_FONT_DIRECTORY "/" DEFAULT_FONT
 	};
+	static const char *default_font = NULL;

+	if (default_font)
+		return g_strdup (default_font);
+
 	for (i = 0; i < EEL_N_ELEMENTS (default_fonts); i++) {
 		if (g_file_exists (default_fonts[i])) {
-			return g_strdup (default_fonts[i]);
+			default_font = default_fonts[i];
+			return g_strdup (default_font);
 		}
 	}

@@ -1244,10 +1249,15 @@ eel_font_manager_get_default_bold_font (
 		DEFAULT_FONT_DIRECTORY "/" DEFAULT_BOLD_FONT,
 		SOURCE_FONT_DIRECTORY "/" DEFAULT_BOLD_FONT
 	};
+	static const char *default_bold_font = NULL;

+	if (default_bold_font)
+		return g_strdup (default_bold_font);
+
 	for (i = 0; i < EEL_N_ELEMENTS (default_bold_fonts); i++) {
 		if (g_file_exists (default_bold_fonts[i])) {
-			return g_strdup (default_bold_fonts[i]);
+			default_bold_font = default_bold_fonts[i];
+			return g_strdup (default_bold_font);
 		}
 	}






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