Slowness in opening large directories (bug 682836 and 356836)



Hi, all.

I'm hitting this bug discussed in bugzilla [1][2].

For example, when I open /usr/bin, which contains around 3000 files
(directories seen as files), I have to wait for about 20 seconds until
nautilus displays any files. During these 20 seconds, nautilus shows
nothing but a "loading" tips at the right-bottom corner.  (It loads
faster for the second time in a session, about 5 seconds).

What I expect is, nautilus immediately displays the files that have been
loaded, rather than remain blank before finishing all work.

I generated a trace by running "strace -ttt -f nautilus-trace
nautilus", and finally ran "grep MARK nautilus-trace >
nautilus-trace-strip" to strip the useless lines. You can use
plot-timeline.py to visualize it.  I attached this log to this mail
and bug[1].

AFAIK, the most useful information in this log is the
`dequeue_pending_idle_callback' function. It has been called multiple
times and every time load a few files (like 100 files). It seems work
in that way I expect, but don't know why it doesn't refresh the view
every time.  Thus I took a quick look at the sources and found
following statements at function `queue_pending_files' in
`src/nautilus-view.c', which is invoked during running
`dequeue_pending_idle_callback'.

if (! view->details->loading || nautilus_directory_are_all_files_seen (directory)) { schedule_timeout_display_of_pending_files (view, view->details->update_interval);
}

It seems be the reason why the view not display files during
loading. The display function is only invoked after nautilus has
loaded all files.

I made a patch and attached to this mail and bug[1]. This patch just
remove the `if' statement and leave the display function.  It works fine
for me. Now nautilus can continually display the files while
loading. However, I'm not quite clear with the internal of nautilus,
so this patch may cause other bugs and potential risks.


In addition, the behaviors of nautilus is still not perfect even if it
can continually display files.

1. While loading, the file objects are constantly moving quickly, so
in fact, you can't do anything, such as open a sub-directory or a
file.  This also happen in one of my directory contains 200+ pictures
and 20+ sub-folders (with either nautilus 3.6 or 3.7). By the way, it
seems load directory first then regular files.
I don't know if somebody has filed a relevant bug. If not, maybe I
should file one.

2. nautilus should load all files as soon as `ls' and put them on the
view, may without specific icons and metadatas. So that we can do
something like open a sub-folder, rather than wait for this sub-folder
shows up. Then it loads the icons continually.

I tested dolphin, it can open my /usr/bin in a flash (I did a quick
scrolling and confirm it does show all my files) then loads the icons and
other things.

Thanks. Any suggestions?

[1] https://bugzilla.gnome.org/show_bug.cgi?id=682836
[2] https://bugzilla.gnome.org/show_bug.cgi?id=356836

>From 9d38acb279709499b81eab827b74dfc3b6c15618 Mon Sep 17 00:00:00 2001
From: YE Qianchuan <stool ye gmail com>
Date: Wed, 6 Feb 2013 16:12:39 +0800
Subject: [PATCH] A quick fix for slow opening of large directories. It may
 causes other problems.

---
 src/nautilus-view.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 074a153..f2dc883 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -3678,9 +3678,7 @@ queue_pending_files (NautilusView *view,
 	*pending_list = g_list_concat (file_and_directory_list_from_files (directory, files),
 				       *pending_list);
 
-	if (! view->details->loading || nautilus_directory_are_all_files_seen (directory)) {
-		schedule_timeout_display_of_pending_files (view, view->details->update_interval);
-	}
+	schedule_timeout_display_of_pending_files (view, view->details->update_interval);
 }
 
 static void
-- 
1.8.1.2

Attachment: nautilus-strace-strip.gz
Description: GNU Zip compressed data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]