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 154394 - gtkfilechooserbutton instantiation really slow
gtkfilechooserbutton instantiation really slow
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.5.x
Other Linux
: Normal normal
: Medium fix
Assigned To: gtk-bugs
Federico Mena Quintero
filechooser-beginner-fix
Depends on:
Blocks: 135738
 
 
Reported: 2004-10-03 18:24 UTC by Christian Persch
Modified: 2013-09-23 21:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
extreme testcase as patch to testfilechooserbutton.c, adds 20 file chooser buttons instead of one (3.45 KB, text/plain)
2004-10-03 18:25 UTC, Christian Persch
Details

Description Christian Persch 2004-10-03 18:24:45 UTC
When you add a (or some) GtkFileChooserButton(s) to a dialogue, it will slow the
opening of the dialogue down; the more chooser buttons, the slower. This is
because each GtkFileChooserButton instantiates one GtkFileChooserDialog, which
scans the directory, which is slow.
Comment 1 Christian Persch 2004-10-03 18:25:30 UTC
Created attachment 32186 [details]
extreme testcase as patch to testfilechooserbutton.c, adds 20 file chooser buttons instead of one
Comment 2 Christian Persch 2004-12-03 01:28:43 UTC
Is there a way to inhibit the GtkFileChooser dialog reading the directory
contents until it's actually shown, as oppsed to when it's created?
Comment 3 James Cape 2004-12-03 01:33:19 UTC
I *think* that it reads the dir contents asynchronously now, but I could be
mistaken...
Comment 4 James Cape 2004-12-03 01:34:04 UTC
GtkFileChooserDefault is what (needs to be?) changed in that case.
Comment 5 James Cape 2005-03-29 16:47:54 UTC
The proper fix for this bug (AFAIK) is to not create the GtkFileChooserDialog on
construct, and basically do the same kinds of storage, validation, and signal
emission until the user opens the dialog (via click or "Other") -- then copy the
data over and free the data. It's a fairly large-sized job, since it'd basically
mean:

if (button->priv->dialog)
  do_via_dialog ();
else 
  do_via_button ();

all over the place.

Another memory-saver would include only keeping either the button or the
combo-box in-memory at any one time, and sharing the GtkListStore (code, at
least) for the shortcuts with GtkFileChooserDialog.
Comment 6 Federico Mena Quintero 2005-04-28 20:06:25 UTC
See also bug #166601 and bug #302322.
Comment 7 Federico Mena Quintero 2005-06-15 20:20:52 UTC
A few things:

With the current implementation of both GtkFilesystemUnix and
GtkFileSystemGnomeVFS, folder objects are singletons within a particular
instance of GtkFileSystem.

However, four chooser buttons mean four GtkFileSystem objects, or possibly more
--- I don't think that GtkFileChooserDefault and GtkFileChooserEntry, for
example, share the same GtkFileSystem object.

A first patch would be to share the file system objects.

A second patch would result after profiling why setup time is so large.
Comment 8 Federico Mena Quintero 2005-10-05 05:31:05 UTC
I think this is fixed with my patch to not do loading until ::map().  Can you
please confirm?  That patch is now in HEAD and gtk-2-8.
Comment 9 Christian Persch 2005-10-05 11:20:22 UTC
It seems usable now with a few filechooserbuttons, although it's still somewhat
slow (but much better than when I last tried this) when you have really many of
them (which shouldn't be a too common situation). I guess this bug can be closed
now.

If you're interested, I've updated my testfilechooserbutton patch to add a
variable number of filechooserbuttons, @
http://www.gnome.org/~chpe/patches/many-filechooserbuttons.diff .
Comment 10 Federico Mena Quintero 2005-10-05 14:34:34 UTC
Chrisian:  could you hack up a little program to create a window with a bunch of
GtkFileChooserButtons, then destroy the window once it is mapped/exposed?  And
run that in a loop a few hundred times?  And run sysprof on it? :)  I'd love to
see the results.
Comment 11 Baptiste Mille-Mathias 2007-08-03 21:42:01 UTC
Dear hackers, 

Any news on this bug ?

regards

-- 
This message is brought to you by your beloved Bugs cleaning team, 
Comment 12 Murray Cumming 2008-05-17 10:52:48 UTC
Maybe bug #354887 is relevant? It's about FileChooserButton asking for authentication unnecessarily. Maybe the slowness is due to unnecessary network IO?
Comment 13 Federico Mena Quintero 2013-09-23 21:00:47 UTC
Marking as obsolete; we need new profiles.