-   Linux - Desktop (
-   -   Variable width fonts and performance (

Gullible Jones 03-21-2014 09:24 AM

Variable width fonts and performance
Something I noticed while messing around with gtkperf...

500 text add operations with Dejavu Sans Mono font:

GtkTextView - Add text - time: 10.73

vs. 500 text add operations with Dejavu Sans variable width font:

GtkTextView - Add text - time: 35.29


Do variable width fonts necessarily render more slowly, or has this more to do with how GTK2 does font rendering?

(If the former, I wonder if variable width fonts are responsible for some of the sluggishness of GTK2 on computers with low spec CPUs.)

DavidMcCann 03-21-2014 12:17 PM

That's an interesting result! I suspect it would apply with any graphics toolkit: the more complex the font, the more work there'll be to do. In the old days, text display could be really fast on the simplest machines because there were no vector fonts, only bit-map ones.

Gullible Jones 03-21-2014 10:29 PM

Yeah, it looks like maybe font kerning is slow? I don't know. The results on my laptop with Ubuntu Sans vs. Ubuntu Mono are even more insane though:

GtkTextView - Add text - time: 33.74


GtkTextView - Add text - time: 5.15

Makes me think it might be worth switching to monospace fonts for most widgets on slower machines, if you can find ones that are easily readable. Those differences will add up.

Edit: what's more interesting is that appending the text slows down drastically as the amount of previous text increases. Not sure if that's a GTK2 problem, or a problem with the gtkperf program; I think it smacks a bit of data structure issues...

All times are GMT -5. The time now is 06:24 AM.