After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734915 - large slowdown of separator and data functions when many fonts present
large slowdown of separator and data functions when many fonts present
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkComboBox
2.24.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-16 17:40 UTC by Liam White
Modified: 2018-04-15 00:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (2.83 KB, text/plain)
2014-08-16 17:43 UTC, Liam White
Details

Description Liam White 2014-08-16 17:40:41 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
Comment 1 Liam White 2014-08-16 17:43:41 UTC
Created attachment 283608 [details]
test case
Comment 2 Liam White 2014-08-16 17:49:59 UTC
typo: GTK+ 3 greater than or equal to 3.10 instead of GTK+ 3 <= 3.10
Comment 3 Liam White 2014-08-17 02:15:34 UTC
Workaround:

- Add the separator function first
- Call gtk_widget_show_all on the combo box
- Then add the cell data function
Comment 4 Matthias Clasen 2018-02-10 05:07:42 UTC
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.
Comment 5 Matthias Clasen 2018-04-15 00:30:08 UTC
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