CFF loading overhead in tracing

2023-07-30 Thread Behdad Esfahbod
Hi,

In benchmarking FreeType face loading, I noticed that the following two
loops take considerable time when loading CFF1 face:


--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -695,8 +695,8 @@


   FT_TRACE4(( "  %5d ", idx + 390 ));
-  for ( l = 0; l < s1len; l++ )
-FT_TRACE4(( "%c", s1[l] ));
+  //for ( l = 0; l < s1len; l++ )
+//FT_TRACE4(( "%c", s1[l] ));
   FT_TRACE4(( "\n" ));
 }

@@ -710,8 +710,8 @@


   FT_TRACE4(( "  %5d ", cff->num_strings + 390 ));
-  for ( l = 0; l < s1len; l++ )
-FT_TRACE4(( "%c", s1[l] ));
+  //for ( l = 0; l < s1len; l++ )
+//FT_TRACE4(( "%c", s1[l] ));
   FT_TRACE4(( "\n" ));
 }
   }


I don't have tracing enabled, but the compiler doesn't seem to have wiped
away the loop. I'm not sure why. At any rate, I wonder if these can be
guarded by FT_DEBUG_TRACE or some other way to remove the overhead?


behdad
http://behdad.org/


Re: CFF loading overhead in tracing

2023-07-30 Thread Behdad Esfahbod
Humm. I cannot reproduce this anymore. Will report if that changes.

behdad
http://behdad.org/


On Sun, Jul 30, 2023 at 12:41 PM Behdad Esfahbod  wrote:

> Hi,
>
> In benchmarking FreeType face loading, I noticed that the following two
> loops take considerable time when loading CFF1 face:
>
>
> --- a/src/cff/cffobjs.c
> +++ b/src/cff/cffobjs.c
> @@ -695,8 +695,8 @@
>
>
>FT_TRACE4(( "  %5d ", idx + 390 ));
> -  for ( l = 0; l < s1len; l++ )
> -FT_TRACE4(( "%c", s1[l] ));
> +  //for ( l = 0; l < s1len; l++ )
> +//FT_TRACE4(( "%c", s1[l] ));
>FT_TRACE4(( "\n" ));
>  }
>
> @@ -710,8 +710,8 @@
>
>
>FT_TRACE4(( "  %5d ", cff->num_strings + 390 ));
> -  for ( l = 0; l < s1len; l++ )
> -FT_TRACE4(( "%c", s1[l] ));
> +  //for ( l = 0; l < s1len; l++ )
> +//FT_TRACE4(( "%c", s1[l] ));
>FT_TRACE4(( "\n" ));
>  }
>}
>
>
> I don't have tracing enabled, but the compiler doesn't seem to have wiped
> away the loop. I'm not sure why. At any rate, I wonder if these can be
> guarded by FT_DEBUG_TRACE or some other way to remove the overhead?
>
>
> behdad
> http://behdad.org/
>