auctex-devel
[Top][All Lists]
Advanced

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

Re: Cleaning up temporal markers


From: David Kastrup
Subject: Re: Cleaning up temporal markers
Date: Wed, 07 Jul 2021 14:40:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> Hi Arash, thanks for your reply.
>
>>>>>> Arash Esbati <arash@gnu.org> writes:
>> I've checked only the 2 functions `LaTeX-env-figure' and
>> `LaTeX-fill-region-as-paragraph' and my understanding is that for
>> let-bound markers in a function body, you don't have to clean up as
>> described above.
>
> Oh, really? I didn't know that!

You don't have to, sure.  But then the markers will get maintained until
next garbage collection, won't they?  That's what slowing down the
editing.  Unassociating them with the buffer will not garbage-collect
them, but it will stop their performance implications until they get
collected.

The Elisp manual says this:

       Insertion and deletion in a buffer must check all the markers and
    relocate them if necessary.  This slows processing in a buffer with
    a large number of markers.  For this reason, it is a good idea to
    make a marker point nowhere if you are sure you don’t need it any
    more.  Markers that can no longer be accessed are eventually removed
    (*note Garbage Collection::).

Note that markers that can no longer be accessed (which would apply to
let-bound markers) are _eventually_ removed in garbage collection.
Until they are removed, the performance implications when they are
associated with a buffer remain.

In theory, the Elisp compiler might realise that a let-bound marker has
become inaccessible and might detach it on its own.  But relying on that
would seem imprudent, and it would be probably a bit daring for an
optimisation.

>> IIRC the Emacs lisp reference is not clear about this point.  It
>> would be good if someone gives a definite answer about my assumption
>> above.
>
> Yeah, I'd appreciate if someone clarifies this point.

As I read the Elisp reference, it is pretty clear.  What other
interpretation do you read into the text?

-- 
David Kastrup



reply via email to

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