emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Slow operations on buffers of tens of megabytes


From: Reiner Steib
Subject: Re: Slow operations on buffers of tens of megabytes
Date: Tue, 07 Nov 2006 15:13:10 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux)

[ Cc-ing Elias Oltmanns; See
  <http://thread.gmane.org/or4ptezc71.fsf%40fsfla.org> or
  <http://thread.gmane.org/gmane.emacs.gnus.general/63925/focus=63929>
  for the full thread. ]

On Mon, Nov 06 2006, Alexandre Oliva wrote:

> On Nov  6, 2006, Reiner Steib <address@hidden> wrote:
>
>> My guess is that it's problem with case-fold-search when searching for
>> "X-Gnus-Article-Number" in mbox files in Emacs 22 as analyzed by Elias
>> Oltmanns back in June:
>
> Yep, that's it!
>
>> | --- ~/.emacs ---
>> | (unless (< emacs-major-version 22)
>> |   (set-case-syntax 331856 "w" (standard-case-table))
>> |   (set-case-syntax 331857 "w" (standard-case-table)))
>> | --- ~/.emacs ---
>
> This makes gnus blazingly fast again.
>
>> | We could also add a minor mode to set up the case table all the way
>> | for Turkish.
>> | 
>> | Would someone like to do that?
>
> I can try to take a stab at it, but not being an Emacs hacker I just
> barely understand the relationship between the reported bug and the
> ultimate cause reported in the e-mail, nevermind the proposed work
> around, that is indistinguishable from magic to me ;-)
>
> I guess this means I may need some hand-holding, and at this point I'm
> not sure that would be more work than actually making the changes.
> Please advise.

If the problem can't be solved in Emacs, we could maybe change
`nnheader-find-file-noselect' to change the case table for the mbox
files.  The current code reads:

--8<---------------cut here---------------start------------->8---
(defun nnheader-find-file-noselect (&rest args)
  "Open a file with some variables bound.
See `find-file-noselect' for the arguments."
  (let* ((format-alist nil)
         (auto-mode-alist (mm-auto-mode-alist))
         (default-major-mode 'fundamental-mode)
         (enable-local-variables nil)
         (after-insert-file-functions nil)
         (enable-local-eval nil)
         (coding-system-for-read nnheader-file-coding-system)
         (version-control 'never)
         (ffh (if (boundp 'find-file-hook)
                  'find-file-hook
                'find-file-hooks))
         (val (symbol-value ffh)))
    (set ffh nil)
    (unwind-protect
        (apply 'find-file-noselect args)
      (set ffh val))))
--8<---------------cut here---------------end--------------->8---

I expect that (apply 'find-file-noselect args) could be changed to:

--8<---------------cut here---------------start------------->8---
        (with-current-buffer (apply 'find-file-noselect args)
          (unless (or (featurep 'xemacs)
                      ;; Better check?
                      (< emacs-major-version 22))
            ;; Apply ASCII-only case-table. Don't modify the
            ;; standard-case-table.
            (SOME-CASE-TABLE-CODE)))
--8<---------------cut here---------------end--------------->8---

I don't know much about case tables in Emacs (and I don't have time to
dig deeper into the Lisp Manual).  Any suggestion on what
SOME-CASE-TABLE-CODE should look like?  Alexandre and Elias: Does this
patch give good results?

--8<---------------cut here---------------start------------->8---
--- nnheader.el 01 Aug 2006 12:10:19 +0200      7.24
+++ nnheader.el 07 Nov 2006 15:08:52 +0100      
@@ -997,7 +997,13 @@
         (val (symbol-value ffh)))
     (set ffh nil)
     (unwind-protect
-       (apply 'find-file-noselect args)
+       (with-current-buffer (apply 'find-file-noselect args)
+         (unless (or (featurep 'xemacs)
+                     ;; Better check?
+                     (< emacs-major-version 22))
+           ;; Apply ASCII-only case-table.  Don't modify the
+           ;; standard-case-table.
+           (set-case-table (make-char-table 'case-table))))
       (set ffh val))))
 
 (defun nnheader-directory-regular-files (dir)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]