[Mew-dist 12014] Re: immv to large size directory

Masaki KONUMA konuma at example.com
2000年 1月 7日 (金) 00:33:50 JST


こぬまです。

From: Kazu Yamamoto (山本和彦) <kazu at example.com>
Subject: [Mew-dist 11504] Re: immv to large size directory
Date: Sun, 28 Nov 1999 00:14:00 +0900

> 最大の値を探すだけなのに、メッセージを全部なめ、ソートして、しかもその
> 結果を使っていない。

mew も (directory-files dir) するときに無駄にソートしてます。

たとえば、

| (length (directory-files (mew-expand-folder "+mew-dist")))
|   --> 8737
| (etime '(mew-folder-new-message "+mew-dist"))
|   --> 0.307427

のような mew-folder-new-message で、ソートしないようにすると、

-	 (msgs (directory-files dir nil mew-regex-message-files))
+	 (msgs (directory-files dir nil nil t))

| (etime '(mew-folder-new-message "+mew-dist"))
|   --> 0.205254

ってなかんじで速くなります。

# etime: Returns the time required for re-evaluate the argument.

-- 小沼雅樹
-------------- next part --------------
diff -ur ../mew-1.95b16/mew-func.el ./mew-func.el
--- ../mew-1.95b16/mew-func.el	Tue Dec 28 17:00:37 1999
+++ ./mew-func.el	Thu Jan  6 23:48:42 2000
@@ -495,7 +495,7 @@
       (setq dir (mew-imap-folder-dir folder mew-temp-dir)))
     (if (and (file-exists-p dir) (file-directory-p dir))
 	(progn
-	  (setq files (directory-files dir t mew-regex-message-files))
+	  (setq files (directory-files dir t mew-regex-message-files t))
 	  (while files
 	    (if (file-writable-p (car files))
 		(delete-file (car files)))
@@ -541,7 +541,7 @@
 
 (defun mew-folder-new-message (folder &optional num-only)
   (let* ((dir (mew-expand-folder folder))
-	 (msgs (directory-files dir nil mew-regex-message-files))
+	 (msgs (directory-files dir nil nil t))
 	 (max 0) cur maxfile)
     (while msgs
       (setq cur (string-to-int (car msgs)))
@@ -553,7 +553,7 @@
 	() ;; OK
 	;; due to NFS?
       (mew-touch-folder folder) ;; can clear cache?
-      (setq msgs (directory-files dir nil mew-regex-message-files))
+      (setq msgs (directory-files dir nil nil t))
       (setq max 0)
       (while msgs
 	(setq cur (string-to-int (car msgs)))
@@ -612,7 +612,7 @@
 
 (defmacro mew-directory-empty-p (dir)
   "See if DIR never contains files"
-  (` (null (directory-files (, dir) nil mew-regex-files))))
+  (` (null (directory-files (, dir) nil mew-regex-files t))))
 
 (defun mew-make-directory (path)
   (let ((parent (directory-file-name (file-name-directory path))))
@@ -627,7 +627,7 @@
 (defun mew-delete-directory-recursively (dir)
   (if (not (file-directory-p dir))
       ()
-    (let ((files (directory-files dir t mew-regex-files)))
+    (let ((files (directory-files dir t mew-regex-files t)))
       (while files
 	(cond
 	 ((file-symlink-p (car files))
@@ -638,7 +638,7 @@
 	 (t
 	  (delete-file (car files))))
 	(setq files (cdr files))))
-    (if (null (directory-files dir t mew-regex-files))
+    (if (null (directory-files dir t mew-regex-files t))
 	(delete-directory dir))))
 
 ;;
diff -ur ../mew-1.95b16/mew-mark.el ./mew-mark.el
--- ../mew-1.95b16/mew-mark.el	Sat Dec 25 19:26:05 1999
+++ ./mew-mark.el	Thu Jan  6 23:50:01 2000
@@ -782,7 +782,7 @@
   "Remove all messages in +trash."
   (interactive)
   (let* ((trashdir (mew-expand-folder mew-trash-folder))
-	 (msgs (directory-files trashdir nil mew-regex-message-files)))
+	 (msgs (directory-files trashdir nil mew-regex-message-files t)))
     (if (null msgs)
 	(message "No messages to be removed in %s" mew-trash-folder)
       (if (yes-or-no-p (format "Remove all messages in %s? " mew-trash-folder))
diff -ur ../mew-1.95b16/mew-summary.el ./mew-summary.el
--- ../mew-1.95b16/mew-summary.el	Tue Dec 28 17:00:38 1999
+++ ./mew-summary.el	Thu Jan  6 23:48:27 2000
@@ -1668,7 +1668,7 @@
   (and (not mew-flush-process)
        mew-queue-folder
        (directory-files (mew-expand-folder mew-queue-folder)
-			nil mew-regex-message-files)))
+			nil mew-regex-message-files t)))
 
 (defun mew-summary-flush-queue ()
   "Flush the mail queue explicitly."


Mew-dist メーリングリストの案内