emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs awfully slow on some files


From: David Kastrup
Subject: Re: Emacs awfully slow on some files
Date: Fri, 14 Aug 2009 10:09:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Fabian Ezequiel Gallina <address@hidden> writes:

> 2009/8/11 Stefan Monnier <address@hidden>:
>>> I have a file which is 1 MB long and all of the content is on a single
>>> line.  Using Emacs on this file is pretty much impossible due to the
>>> super-sluggish behavior.  It's embarrassing.  Why is this?
>>
>> It's probably a combination of various pieces of code which make
>> incorrect assumptions about the expected line length.
>>
>>> Can it be fixed?
>>
>> Yes.
>>
>>
>
> Where should I start looking at in order to try fix this. I really
> would like to be able to use Emacs on ugly files too.

There is

    cache-long-line-scans is a variable defined in `C source code'.
    Its value is nil

      Automatically becomes buffer-local when set in any fashion.

    Documentation:
    Non-nil means that Emacs should use caches to handle long lines more 
quickly.

    Normally, the line-motion functions work by scanning the buffer for
    newlines.  Columnar operations (like `move-to-column' and
    `compute-motion') also work by scanning the buffer, summing character
    widths as they go.  This works well for ordinary text, but if the
    buffer's lines are very long (say, more than 500 characters), these
    motion functions will take longer to execute.  Emacs may also take
    longer to update the display.

    If `cache-long-line-scans' is non-nil, these motion functions cache the
    results of their scans, and consult the cache to avoid rescanning
    regions of the buffer until the text is modified.  The caches are most
    beneficial when they prevent the most searching---that is, when the
    buffer contains long lines and large regions of characters with the
    same, fixed screen width.

    When `cache-long-line-scans' is non-nil, processing short lines will
    become slightly slower (because of the overhead of consulting the
    cache), and the caches will use memory roughly proportional to the
    number of newlines and characters whose screen width varies.

    The caches require no explicit maintenance; their accuracy is
    maintained internally by the Emacs primitives.  Enabling or disabling
    the cache should not affect the behavior of any of the motion
    functions; it should only affect their performance.


However, this variable has defaulted to nil for quite a long time.  I
should be surprised if setting it non-nil would not tend to exhibit
bugs.

-- 
David Kastrup





reply via email to

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