[Nautilus-list] Re: Icon factory caching



On Fri, 5 Oct 2001, Alex Larsson wrote:

> The icon factory currently only caches unused icons for 10 seconds. I 
> think this is about the right time since we want to conserve memory, but 
> the problem is that each time you drop the icon from the cache, re-reading 
> it needs to stat a whole lot of files looking for the actual icon file.
> 
> Take a look at this strace segment looking for the i-web icon:
> 15:41:49.900540 stat64("/opt/nautilus/share/pixmaps/nautilus/eazel-logos/redhat/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
> 15:41:49.986099 lstat64("/opt/nautilus/share/pixmaps/nautilus/i-web-72.png", {st_mode=S_IFREG|0644, st_size=10963, ...}) = 0
> 15:41:49.986279 open("/opt/nautilus/share/pixmaps/nautilus/i-web-72.png", O_RDONLY) = 18
> 
> That is .1 seconds worth of stat:ing around, before finally finding the 
> one we want.

The simple "fix":
Index: libnautilus-private/nautilus-file-utilities.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file-utilities.c,v
retrieving revision 1.102
diff -u -p -r1.102 nautilus-file-utilities.c
--- libnautilus-private/nautilus-file-utilities.c	2001/09/15 19:17:48	1.102
+++ libnautilus-private/nautilus-file-utilities.c	2001/10/05 20:21:18
@@ -191,12 +191,14 @@ nautilus_pixmap_file (const char *partia
 {
 	char *path;
 
+#if 0
 	/* Look for a non-GPL Eazel logo version. */
 	path = nautilus_make_path (DATADIR "/pixmaps/nautilus/eazel-logos", partial_path);
 	if (g_file_exists (path)) {
 		return path;
 	}
 	g_free (path);
+#endif
 
 	/* Look for a GPL version. */
 	path = nautilus_make_path (DATADIR "/pixmaps/nautilus", partial_path);
Index: libnautilus-private/nautilus-icon-factory.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-factory.c,v
retrieving revision 1.229
diff -u -p -r1.229 nautilus-icon-factory.c
--- libnautilus-private/nautilus-icon-factory.c	2001/09/26 16:37:16	1.229
+++ libnautilus-private/nautilus-icon-factory.c	2001/10/05 20:21:18
@@ -69,15 +69,15 @@
 static const char *icon_file_name_suffixes[] =
 {
 	".svg",
-	".SVG",
+	//	".SVG",
 	".png",
-	".PNG",
-	".gif",
-	".GIF",
+	//	".PNG",
+	//	".gif",
+	//	".GIF",
 	".jpg",
-	".JPG",
-	".xpm",
-	".XPM"
+	//	".JPG",
+	//	".xpm",
+	//	".XPM"
 };
 
 #define ICON_NAME_BLOCK_DEVICE          "i-blockdev"

Got this down to:

16:17:54.020863 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.021737 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.021931 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.022053 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.022171 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.022329 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.022539 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.022663 stat64("/opt/nautilus/share/pixmaps/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.022786 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-20.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.022902 stat64("/opt/nautilus/share/pixmaps/i-web-20.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.023021 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-20.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.023138 stat64("/opt/nautilus/share/pixmaps/i-web-20.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.023267 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.023447 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.023562 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.023678 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.023791 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.023911 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.024027 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.024141 stat64("/opt/nautilus/share/pixmaps/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.024259 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-24.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.024375 stat64("/opt/nautilus/share/pixmaps/i-web-24.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.024494 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-24.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.024610 stat64("/opt/nautilus/share/pixmaps/i-web-24.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.024731 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.024851 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.024965 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.025092 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.025206 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.025321 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.025437 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.025549 stat64("/opt/nautilus/share/pixmaps/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.025665 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-36.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.025781 stat64("/opt/nautilus/share/pixmaps/i-web-36.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.025898 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-36.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.026013 stat64("/opt/nautilus/share/pixmaps/i-web-36.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.026132 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.026249 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.026361 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.026476 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.026589 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.026704 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.026819 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.026931 stat64("/opt/nautilus/share/pixmaps/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.027040 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.027154 stat64("/opt/nautilus/share/pixmaps/i-web.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.027301 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.027415 stat64("/opt/nautilus/share/pixmaps/i-web.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.027532 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.027651 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.027763 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.png", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.027879 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.png", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.027993 stat64("/opt/nautilus/share/pixmaps/nautilus/redhat/i-web.jpg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.028109 stat64("/opt/nautilus/share/pixmaps/redhat/i-web.jpg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.028224 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.svg", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.028337 stat64("/opt/nautilus/share/pixmaps/i-web.svg", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.028455 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web-72.png", {st_mode=S_IFREG|0644, st_size=10963, ...}) = 0
16:17:54.028626 stat64("/opt/nautilus/share/pixmaps/nautilus/i-web.xml", 0xbffff0f0) = -1 ENOENT (No such file or directory)
16:17:54.028742 stat64("/opt/nautilus/share/pixmaps/i-web.xml", 0xbffff0e0) = -1 ENOENT (No such file or directory)
16:17:54.028963 lstat64("/opt/nautilus/share/pixmaps/nautilus/i-web-72.png", {st_mode=S_IFREG|0644, st_size=10963, ...}) = 0
16:17:54.029142 open("/opt/nautilus/share/pixmaps/nautilus/i-web-72.png", O_RDONLY) = 18

That is only 58 stats taking 0.008279 seconds. I.e. a 10x speedup. And 
nautilus *does* feel snappier with this, although i have no hard data.

/ Alex





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