[PATCH] Add more nautilus_file..._nocopy variants



I hoped to significantly speed up Nautilus by caching each
NautilusFile's URI and exposing API for getting cached file info.

However, unfortunately loading "/usr/lib" 100 times per sample, taking
~5 samples and comparing the average didn't show any significant speed
gain. Nevertheless, I'm attaching the patch and the hack I used to
measure the speed, which was used in combination with the "time" utility
and might be handy for other people with similar attempts.

While Nautilus seems to be a bit snappier when using it, especially when
selecting many items (cf. below) this could also well be for
psychological reasons.

I remember from former development sessions that printf-debugging showed
many subsequent calls of the mentioned helpers, escpeially when menus
are updated. Thus, the patches may even cause significant performance
gains under some circumstances, for instance when selecting many files.

I'm attaching a bzipped variant of the patch, since the mailing list
doesn't like huge mails.

-- 
Christian Neumair <chris gnome-de org>
Index: src/nautilus-window-manage-views.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-manage-views.c,v
retrieving revision 1.357
diff -u -p -r1.357 nautilus-window-manage-views.c
--- src/nautilus-window-manage-views.c	28 Oct 2005 12:41:20 -0000	1.357
+++ src/nautilus-window-manage-views.c	2 Dec 2005 18:28:38 -0000
@@ -530,6 +530,11 @@ nautilus_window_open_location_full (Naut
                 g_warning ("Possibly invalid new URI '%s'\n"
                            "This can cause subtle evils like #48423", location);
 
+	g_message ("goto done!");
+	g_object_set_data (G_OBJECT (window), "location-to-open", g_strdup (location));
+	g_object_set_data (G_OBJECT (window), "remaining-open-location", GINT_TO_POINTER (100));
+	g_message ("eh - %d", GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window), "remaining-open-location")));
+
         begin_location_change (target_window, location, new_selection,
                                NAUTILUS_LOCATION_CHANGE_STANDARD, 0, NULL);
 }
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.722
diff -u -p -r1.722 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	24 Nov 2005 20:47:59 -0000	1.722
+++ src/file-manager/fm-directory-view.c	2 Dec 2005 18:28:41 -0000
@@ -2887,6 +2882,29 @@ fm_directory_view_begin_loading (FMDirec
 	g_signal_emit (view, signals[BEGIN_LOADING], 0);
 }
 
+#include "../nautilus-main.h"
+#include "../nautilus-window.h"
+#include "../nautilus-window-manage-views.h"
+
+static void
+open_again (NautilusWindow *window)
+{
+	g_message ("foo! %p", window);
+        gpointer rem = g_object_get_data (G_OBJECT (window), "remaining-open-location");
+        int rem_i = GPOINTER_TO_INT (rem);
+	g_message ("rem_i: %d", rem_i);
+        rem_i--;
+        if (rem_i > 0) {
+                g_object_set_data (G_OBJECT (window), "remaining-open-location", GINT_TO_POINTER (rem_i));
+                g_message ("opening again! %d remaining", rem_i);
+		nautilus_window_reload (window);
+        } else {
+                g_message ("that's it...quitting");
+                nautilus_main_event_loop_quit ();
+        }
+}
+
+
 /**
  * fm_directory_view_end_loading:
  *
@@ -2902,6 +2920,7 @@ fm_directory_view_end_loading (FMDirecto
 	g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
 
 	g_signal_emit (view, signals[END_LOADING], 0);
+	open_again (NAUTILUS_WINDOW (view->details->window));
 }
 
 /**

Attachment: nautilus-nocopy.diff.bz2
Description: application/bzip

Attachment: signature.asc
Description: This is a digitally signed message part



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