Re: [Nautilus-list] EEL patch



Alex,

Patch looks great.  Please commit it.

I think there are other such inefficiencies in the Eel Font Manager.  I
put
a lot of assertions and other checks to make sure that we feed a font
that
exists and is valid to freetype.  However, it turns out that since we
reap
the fonts from the font server (for 99% of users at least) that we
probably
don't need as much sanity checking on fonts.  Anyway, if they show up in 
profiles, then we can fix them more.

thanks

-re

Alex Larsson wrote:
> 
> 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);
>                 }
>         }
> 
> _______________________________________________
> Nautilus-list mailing list
> Nautilus-list lists eazel com
> http://lists.eazel.com/mailman/listinfo/nautilus-list




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