FLTK logo

Re: [fltk/fltk] fl_font(...) performance issue (#147)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] fl_font(...) performance issue (#147) erco77 Oct 22, 2020  
 

I'm probably not gonna know this one, but it looks to me like you're loading each one of the 2650 fonts and doing stuff with them, e.g.

for (int i = 0; i < numfonts; i++) {           // all 2650 fonts
    fntname = Fl::get_font_name((Fl_Font)i);   // find the font
    ..
    fl_font(i, 14);                      // set it
    if (fl_width('.') == fl_width('W'))  // request a measurement of two glyphs

I guess I'm not surprised it takes a long time to cache that many truetype fonts into memory (all of them!), and access them the first time, as I imagine subsequent accesses (once they've all been loaded into memory) will be instantaneous, but it does take time (and memory!) to cache the first time the application loads them. I imagine the memory use of this application (before it exits) is quite large, or perhaps it's loaded by a font daemon, I'm not sure. Try using top(1) and sort by memory use to see if the app or a font daemon is being stressed for memory while the app remains running (add a sleep(300) before exiting the program to keep it running so the caches don't dump on exit).

I imagine you wouldn't see this in gimp because in order to do the equivalent operation you'd have to pick each font manually and measure the relatively small amount of time between each font load, but added up would likely be equivalent.

In LibreOffice you might see the same thing if you create e.g. a word document that has a few characters from each of the 2600 fonts, then after a reboot, load that document and see how long it takes; I imagine load time would be similar.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.