unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Joakim Jalap <joakim.jalap@fastmail.com>
To: Andreas Politz <politza@hochschule-trier.de>
Cc: emacs-devel@gnu.org
Subject: Re: Overlay tree. Stuck again
Date: Fri, 03 Feb 2017 13:35:06 +0100	[thread overview]
Message-ID: <87bmujpi4l.fsf@fastmail.com> (raw)
In-Reply-To: <87poizsmpb.fsf@hochschule-trier.de> (Andreas Politz's message of "Fri, 03 Feb 2017 09:28:00 +0100")

Andreas Politz <politza@hochschule-trier.de> writes:

> Joakim Jalap <joakim.jalap@fastmail.com> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>> [...] try removing them from the tree, and then re-adding them [...]
>>
>> Yes, that is the "big hammer" approach :) I hae thought about it, but I
>> think the problem is that it will be too expensive. [...]
>
> Joakim, I think that trying to somehow manually fix the disorder is at
> least as expensive as a deletion and reinsertion.  Because if it weren't
> you would have essentially discovered a better algorithm for balancing
> trees then the one you've got.

Well this case isn't really about rebalncing, since the tree was
balanced to begin with, and no nodes are deleted or inserted. The
problem is that a few overlays end up in the wrong place in the tree
since I sort by different criteria (memory address) than before for
those overlays which happened to end up with the same start/end.

> The trick is probably to gather the dirty nodes in post-order and delete
> them all at once. This way you're only removing a node, if its
> corresponding sub-tree is in order.  After that you're free to reinsert
> them again.

Yes, that should do it. But that would be many traversals of the tree,
so I'm afraid it would be too slow.

Anyway, I'm trying a new approach now, where the tree is separate from
the acual struct Lisp_Overlays, but each overlay is linked to a node in
the tree with a pointer (and vice versa). I think this might be easier
(that's my theory at least).

>
> -ap

-- Joakim



  reply	other threads:[~2017-02-03 12:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 21:10 Overlay tree. Stuck again Joakim Jalap
2017-01-13  8:12 ` Eli Zaretskii
2017-01-13 11:56   ` Joakim Jalap
2017-01-13 13:22     ` Fabrice Popineau
2017-01-13 14:20       ` Joakim Jalap
2017-01-13 13:54     ` Eli Zaretskii
2017-01-13 14:26       ` Joakim Jalap
2017-02-03  8:27     ` Andreas Politz
2017-02-03  8:28     ` Andreas Politz
2017-02-03 12:35       ` Joakim Jalap [this message]
2017-02-03  8:28     ` Andreas Politz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmujpi4l.fsf@fastmail.com \
    --to=joakim.jalap@fastmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=politza@hochschule-trier.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).