lilypond-devel
[Top][All Lists]
Advanced

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

Re: anyone notice speed of 2.17.95 on Windows ?


From: Werner LEMBERG
Subject: Re: anyone notice speed of 2.17.95 on Windows ?
Date: Fri, 13 Dec 2013 10:38:23 +0100 (CET)

>> I will check whether I can improve that in FreeType.
> 
> Is there a reason this would have such a significantly different
> impact in Windows?

No.  It's exactly the same code on both platforms.  However, for
lilypond, even a single-element cache would help, see attached
quick'n'dirty patch (for FreeType).


    Werner
diff --git a/include/internal/tttypes.h b/include/internal/tttypes.h
index ad302b8..dfbb303 100644
--- a/include/internal/tttypes.h
+++ b/include/internal/tttypes.h
@@ -1402,6 +1402,9 @@ FT_BEGIN_HEADER
     FT_Bool               sph_compatibility_mode;
 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 
+    FT_String*            cached_glyph_name;     /* a single-element cache */
+    FT_UInt               cached_glyph_name_index;
+
   } TT_FaceRec;
 
 
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index e0132c9..c8097b5 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -186,6 +186,10 @@
       FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
                   FT_UINT_MAX, root->num_glyphs ));
 
+    if ( face->cached_glyph_name                           &&
+         !ft_strcmp( glyph_name, face->cached_glyph_name ) )
+      return face->cached_glyph_name_index;
+
     for ( i = 0; i < max_gid; i++ )
     {
       FT_String*  gname;
@@ -196,7 +200,12 @@
         continue;
 
       if ( !ft_strcmp( glyph_name, gname ) )
+      {
+        face->cached_glyph_name       = gname;
+        face->cached_glyph_name_index = i;
+
         return i;
+      }
     }
 
     return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]