GNOME Bugzilla – Bug 734915
large slowdown of separator and data functions when many fonts present
Last modified: 2018-04-15 00:30:08 UTC
Currently affects OS X and Linux. GTK+ 2.24.23 I have around 2900 fonts installed. I checked them out from the Google font directory and placed them in ~/.fonts: https://code.google.com/p/googlefontdirectory/ I noticed that launch times of a certain program I develop for were then up considerably, mostly spending time in Pango and Fontconfig functions when I profiled them. I managed to reproduce the issue in the attached file. It is a font lister that creates a combobox and styles fonts in the dropdown list. Unmodified, with 2900 fonts, the program takes around nine seconds to start up fully (on my machine). After commenting out either line 88 or 89 (doesn't matter which), the program starts immediately. I dug through some of the GTK source code but I was unable to determine why it took so long when using both a separator function and a cell data function. If you put a return statement at the beginning of the separator function no significant speed improvement is seen. If you put a return statement at the beginning of the cell data function the program launches almost instantly again. That does not explain why using only one (regardless of which) would cause launch times to be practically instantaneous while using both would be around nine seconds slower. The issue does not seem to be reproducible with GTK+ 3 <= 3.10, but earlier versions of GTK 3 were affected. Steps to reproduce: 0.) Obtain several thousand fonts 1.) Compile fonts.c 2.) Launch executable -- observe startup time 3.) Comment line 89 in fonts.c, recompile 4.) Launch executable -- observe startup time 5.) Uncomment line 89 in fonts.c, comment line 88 in fonts.c, recompile 6.) Launch executable -- observe startup time Expected results: performance runs for all three tests should be approximately equal Actual results: performance run for first test takes an unexpectedly long time
Created attachment 283608 [details] test case
typo: GTK+ 3 greater than or equal to 3.10 instead of GTK+ 3 <= 3.10
Workaround: - Add the separator function first - Call gtk_widget_show_all on the combo box - Then add the cell data function
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla. If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab: https://gitlab.gnome.org/GNOME/gtk/issues/new