emacs-devel
[Top][All Lists]
Advanced

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

Re: Overlays as an AA-tree


From: Andreas Politz
Subject: Re: Overlays as an AA-tree
Date: Mon, 06 Feb 2017 18:32:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Joakim Jalap <address@hidden> writes:

> I don't think it would be that ugly. Instead of:
>
> adjust_overlays_for_insert (current_buffer->overlays);
>
> it will be:
>
> adjust_overlays_for_insert (current_buffer->front_insert_overlays);
> adjust_overlays_for_insert (current_buffer->non_front_insert_overlays);
>

Well, maybe ugly is not the right word.  Take at the current code (where
overlays are split into 2 lists), were you see frequent occurrences of
paired loops etc..

But first, you're not done.  You also need to merge two lists from both
trees sometimes, e.g. if you are looking for the next overlay after some
position. More generally, if the overlays need to be in order.

Secondly, the code which fixes the tree is pretty compact (~10lines) and
in the worst case (all but one overlay need to be reinserted) the
run-time is at most doubled, I think.  But two times little is still not
very much (compared to the status quo anyway) and we spare ourselves
above trouble.

-ap



reply via email to

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