freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Benchmarking FreeType


From: David Turner
Subject: Re: [Devel] Benchmarking FreeType
Date: Fri, 07 Jun 2002 09:39:03 +0200

Bonjour Vincent,

Vincent Caron a écrit :
> 
> Hello,
> 
>   besides the fttimer test whose purpose is to bench the scanline
> renderer, I wanted to know the big figures about some common FreeType
> calls and what the different caches were worth for. I'm using FreeType
> for OpenGL rendering purposes, and I'm having a bunch of glyphs to
> display at _every_ frame. Of course, I'm extensively relying on texture
> cache, but this is sometimes a sparse space : create a double-buffered,
> zbuffered and stenciled 1280x1024 context on a 8MB video card, and
> wonder where your texture memory is gone :).
> 
> I wrote a little program which benchmarks the kind of calls you heavily
> rely on. It also let you test memory pressure and see how much cache
> miss hurts. It also shows why you _must_ use FreeType caches (I've seen
> many libs on the net zapping that part). I'm not sure if it is of
> general interest, but it helps me to separate issues from FT and my code
> for now...
> 
> BTW, it's there : http://zerodeux.net/ft/
> 
> All bench run on a Linux 2.4 box with a P3-800. Read 'us/op' as
> microsecond per operation. Cache memory is 1MB, so there's actually no
> memory outage. On a bitmap font (helvetica 14px, PCF, from XFree86) :
> 
> Load                           :   1.6 us/op
> Load + Get_Glyph               :   2.6 us/op
> Load + Get_Glyph + Get_CBox    :   2.7 us/op
> Get_Char_Index                 :   0.3 us/op
> CMap cache (1st run)           :   0.8 us/op
> CMap cache                     :   0.4 us/op
> Outline cache (1st run)        :   4.8 us/op
> Outline cache                  :   0.5 us/op
> Bitmap cache (1st run)         :   4.0 us/op
> Bitmap cache                   :   0.5 us/op
> SBit cache (1st run)           :   2.6 us/op
> SBit cache                     :   0.5 us/op
> 
> And with the classical MS Arial.ttf :
> 
> Load                           :  72.1 us/op
> Load + Get_Glyph               :  78.7 us/op
> Load + Get_Glyph + Get_CBox    :  78.9 us/op
> Get_Char_Index                 :   0.2 us/op
> CMap cache (1st run)           :   0.8 us/op
> CMap cache                     :   0.4 us/op
> Outline cache (1st run)        :  82.2 us/op
> Outline cache                  :   0.6 us/op
> Bitmap cache (1st run)         : 105.4 us/op
> Bitmap cache                   :   0.5 us/op
> SBit cache (1st run)           : 104.9 us/op
> SBit cache                     :   0.5 us/op
> 
> Comments :
> 
> - on the whole, FT is blazing fast. All loading is done with the default
> FT stream (stdio). Linux cache sure helps a lot.
>
Probably, I'm probably going to run your program with memory-mapped files
to see how the stdio stream affect performance on "lesser" operating
systems like Windows though ;-)
 
> - a SBit cache is a 5x gain on a bitmap font, and is of course
> invaluable on a scalable font. And metrics are ready for immediate use.
>
Right :-)
 
> - a CMapCache_Lookup() is actually slower than a Get_Char_Index(), I'm
> wondering if something is wrong in my code.
>
That's not very surprising, indeed. Fact is that you need a valid FT_Face
handle when calling FT_Get_Char_Index, while the CMap cache allows you to
forget about these objects and provide "font ids" instead.

I'd like to thank you a lot for your program, because I'm going to very
aggressively use them in the very near future to optimise some parts of
the engine, including the cache itself...

I'd also like to include "ftbench.c" as part of the "ft2demos" package,
however, it will need a few small cleanups since its source code probably
only compiles with GCC due to statements like:

   {
     int   array1[ face->num_glyphs ];   // dynamic stack allocation !!
     int   array2[ face->num_glyphs ];

     ....
   }

Could you polish it a bit before we include it ??

Again, thanks a lot, it's going to be extremely useful as I'll detail
once 2.1.1 is out..

Best Regards,

- David Turner
- The FreeType Project  (www.freetype.org)

 
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel



reply via email to

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