Question

Opening a gtk FileChooserDialog is painfully slow for nfs directories containing many files. strace shows a lot of time calling "stat". About 5 calls for each of the files in the directory. How can we switch off the calls to 'stat' and just show a list of filenames without the modification time?

We're using operating Redhat enterprise 4, x86_64, Linux 2.6.9-42.0.8.ELsmp and FileChooser is coming from: /usr/lib64/libgtk-x11-2.0.so.0.400.13 . A test program opens a FileChooserDialog and takes 10 seconds to appear, compared to about 25 ms for 'ls' to list the same directory.

Our eclipse application being crippled by this file selector issue...

Was it helpful?

Solution

The gtk+ and gnome team have a bug report related to this issue, at least since 2005. Recent and future changes in the gnome core libraries will hopefully improve the performance. This issue can be aggravated if you have any bookmarks to network drives in the filechooser menu.

OTHER TIPS

The GTK file open dialog is most probably stat(2)ting all files in the directory. It is an eqivalent of ls -l on the directory, and it should run about that slowly. The output of ls | cat (which is significantly faster) might not be enough, because that one cannot distinguish files from directories.

I'd suggest measuring ls | cat, ls -l and and the GTK file open dialog. If the GTK file open dialog is a lot slower than ls -l, then there is something wrong with GTK (not NFS). I'd run the GTK application through strace, and see what is slow. If the GTK file open dialog has about the same speed as ls -l, I don't think it can be made faster -- perhaps NFS mount flags can be tweaked, NFS clients and servers upgraded, or it is possible to switch to a faster infrastructure such as Samba.

Is the directory mounted noatime? That may help with the stat since the atime for each file will be updated with the stat.

You'll need to remount the nfs mount with -o noatime in order to turn off atime updating.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top