[mew-dist 25101] mew-summary-mark-refile speeded up

KOIE Hidetaka ( 鯉江英隆 ) hide at example.com
2004年 6月 30日 (水) 20:48:29 JST


ふだんよく tr REGEXP RET SPC ... ma mo RET のパターンで
メールをよんでいるのですが
スレッドサマリでのmoがおそいのが気になったので
いつものやりかたを試してみたらそこそこ速くなりました。
以下パッチです。

Index: mew-mark.el
===================================================================
RCS file: /cvsmew/mew/mew-mark.el,v
retrieving revision 1.125
diff -c -F^( -b -r1.125 mew-mark.el
*** mew-mark.el	22 Jun 2004 08:01:07 -0000	1.125
--- mew-mark.el	30 Jun 2004 11:24:12 -0000
*************** (defun mew-mark-put-mark-loop1 (func cou
*** 369,389 ****
  (defun mew-summary-mark-in-physical (fld msg new-mark)
    (save-excursion
      (set-buffer fld)
!     (save-excursion
!       (goto-char (point-min))
!       (when (re-search-forward (mew-regex-sumsyn-msg msg) nil t)
  	(mew-mark-put new-mark)
! 	(set-buffer-modified-p nil)))))
  
  (defun mew-summary-unmark-in-physical (fld msg &optional func)
    (save-excursion
      (set-buffer fld)
!     (save-excursion
!       (goto-char (point-min))
!       (when (re-search-forward (mew-regex-sumsyn-msg msg) nil t)
  	(mew-mark-remove)
  	(if func (funcall func fld msg))
! 	(set-buffer-modified-p nil)))))
  
  (defmacro mew-mark-alist-set (alist fld msg)
    `(let ((imsg (string-to-int ,msg))
--- 369,387 ----
  (defun mew-summary-mark-in-physical (fld msg new-mark)
    (save-excursion
      (set-buffer fld)
!     (when (or (re-search-forward  (mew-regex-sumsyn-msg msg) nil t)
!               (re-search-backward (mew-regex-sumsyn-msg msg) nil t))
        (mew-mark-put new-mark)
!       (set-buffer-modified-p nil))))
  
  (defun mew-summary-unmark-in-physical (fld msg &optional func)
    (save-excursion
      (set-buffer fld)
!     (when (or (re-search-forward  (mew-regex-sumsyn-msg msg) nil t)
!               (re-search-backward (mew-regex-sumsyn-msg msg) nil t))
        (mew-mark-remove)
        (if func (funcall func fld msg))
!       (set-buffer-modified-p nil))))
  
  (defmacro mew-mark-alist-set (alist fld msg)
    `(let ((imsg (string-to-int ,msg))
Index: mew-refile.el
===================================================================
RCS file: /cvsmew/mew/mew-refile.el,v
retrieving revision 1.115
diff -c -F^( -b -r1.115 mew-refile.el
*** mew-refile.el	4 Jun 2004 03:50:26 -0000	1.115
--- mew-refile.el	30 Jun 2004 11:24:12 -0000
*************** (defun mew-summary-refile-body (&optiona
*** 708,722 ****
  	   ((mew-virtual-p)
  	    (save-excursion
  	      (set-buffer fld)
! 	      (save-excursion
! 		(goto-char (point-min))
! 		(when (re-search-forward (mew-regex-sumsyn-msg msg) nil t)
  		  (mew-refile-reset msg)
  		  (mew-refile-set msg folders)
  		  (mew-summary-refile-log fld folders-str)
  		  (mew-summary-refile-override-body folders-str)
  		  (mew-mark-put mew-mark-refile)
! 		  (set-buffer-modified-p nil)))))
  	   (t
  	    (mew-refile-reset msg)
  	    (mew-refile-set msg folders)
--- 708,721 ----
  	   ((mew-virtual-p)
  	    (save-excursion
  	      (set-buffer fld)
!               (when (or (re-search-forward  (mew-regex-sumsyn-msg msg) nil t)
!                         (re-search-backward (mew-regex-sumsyn-msg msg) nil t))
                  (mew-refile-reset msg)
                  (mew-refile-set msg folders)
                  (mew-summary-refile-log fld folders-str)
                  (mew-summary-refile-override-body folders-str)
                  (mew-mark-put mew-mark-refile)
!                 (set-buffer-modified-p nil))))
  	   (t
  	    (mew-refile-reset msg)
  	    (mew-refile-set msg folders)
*************** (defun mew-summary-mark-refile ()
*** 882,890 ****
        (message "Mark refiling...")
        (save-excursion
  	(save-window-excursion
- 	  (goto-char (point-min))
  	  (catch 'loop
! 	    (while (re-search-forward mew-regex-msg-review nil t)
  	      (setq last (mew-summary-refile-body last nil 'no-msg))
  	      (unless last (throw 'loop t))
  	      (forward-line)))
--- 881,889 ----
        (message "Mark refiling...")
        (save-excursion
  	(save-window-excursion
  	  (catch 'loop
! 	    (while (or (re-search-forward  mew-regex-msg-review nil t)
!                        (re-search-backward mew-regex-msg-review nil t))
  	      (setq last (mew-summary-refile-body last nil 'no-msg))
  	      (unless last (throw 'loop t))
  	      (forward-line)))



下のはパッチを入れたときのelp-resultsですが
mew-summary-undo-one()からよばれている
mew-summary-unmark-in-physical()がなんとかならないものかとおもいました。

Function Name                                Call Count  Elapsed Time  Average Time
===========================================  ==========  ============  ============
mew-summary-mark-refile                      1           29.668429     29.668429
mew-summary-refile-body                      300         29.635207999  0.0987840266
mew-mark-put-mark                            300         24.530205000  0.0817673500
mew-summary-undo-one                         300         20.726503000  0.0690883433
mew-summary-unmark-in-physical               300         20.290616     0.0676353866
mew-summary-mark-in-physical                 300         3.5575650000  0.0118585500

--
鯉江英隆 <hide at example.com>



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