From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joakim Jalap Newsgroups: gmane.emacs.devel Subject: Re: Overlays as an AA-tree Date: Mon, 06 Feb 2017 16:33:22 +0100 Message-ID: <878tpjnxkt.fsf@fastmail.com> References: <87d1jylv43.fsf@fastmail.com> <87fujv64mn.fsf@hochschule-trier.de> <87fujvpkzc.fsf@fastmail.com> <87vasr5tqd.fsf@hochschule-trier.de> <87d1ex4kon.fsf@hochschule-trier.de> <87d1evod6x.fsf@fastmail.com> <877f53ftab.fsf@hochschule-trier.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486396576 11406 195.159.176.226 (6 Feb 2017 15:56:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 6 Feb 2017 15:56:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (berkeley-unix) Cc: Stefan Monnier , emacs-devel@gnu.org To: Andreas Politz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 06 16:56:10 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1caleD-0002YG-VK for ged-emacs-devel@m.gmane.org; Mon, 06 Feb 2017 16:56:10 +0100 Original-Received: from localhost ([::1]:49164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caleJ-0000t2-J9 for ged-emacs-devel@m.gmane.org; Mon, 06 Feb 2017 10:56:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1calIG-0007ZY-Tf for emacs-devel@gnu.org; Mon, 06 Feb 2017 10:33:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1calID-0000p9-OP for emacs-devel@gnu.org; Mon, 06 Feb 2017 10:33:28 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44709) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1calID-0000or-Ho for emacs-devel@gnu.org; Mon, 06 Feb 2017 10:33:25 -0500 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id DA3EC20826; Mon, 6 Feb 2017 10:33:24 -0500 (EST) Original-Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Mon, 06 Feb 2017 10:33:24 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=kDes7794YC81Vri7cjsrnqVwIV0=; b=wL8+Oq YE3DsIw69hN8t5qqai1tR+Bic/o188S8/NBqRjn+rx91PatWVh0GVbhx2fg4g+HI CG+dsUlFiwCYwDfxP3wgasqk7JpncPS1AnQzHs6olSk9PUu8hmIBiS1ACyhKbz05 oYq9Mpx7ycw9IO0oXGZQXXghNyVa8cDapNfII= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=kDes7794YC81Vr i7cjsrnqVwIV0=; b=s9M3Q2uBPHlOWruZi3SHPZAbQtohVsi4l1tyj3w/vYgz9g ThiA/TDX979T6o7LOppcUzv146hWygorxa7WLTK15HptxktHqV2xlUKsfMR8GcTK u204lfwGVXtxQ9R8+oSHjx9VdI61/DWYG+FKEwmHrr/vKiAEdZ9QhasaSuo7U= X-ME-Sender: X-Sasl-enc: NkMbunNPx4AsaBi0u/kO7Od7j5mtp5ElF9FHU7HvNKGA 1486395204 Original-Received: from genserv (unknown [5.150.202.248]) by mail.messagingengine.com (Postfix) with ESMTPA id 289547E4B1; Mon, 6 Feb 2017 10:33:24 -0500 (EST) In-Reply-To: <877f53ftab.fsf@hochschule-trier.de> (Andreas Politz's message of "Mon, 06 Feb 2017 12:33:16 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.25 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212035 Archived-At: Andreas Politz writes: >> And here I thought it was rather an elegant solution :) (to the problem >> of one overlay's beg going past another's because of an insert). > > I think the problem is that this would entail either having lots of ugly > code at places where this double-tree is accessed, or having to create > some kind of layer, hiding the fact that there are two trees. 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); I don't think it's that big of a deal. But I guess that's a matter of personal preference. (obviously the member names would be something... better) > I think its safe (in a RB-Tree anyway, AA probably as well) to remove > the root node of the tree, given, that all other nodes are sorted. > > When recursively applied, it tells us that before we are attempting to > remove an unsorted node, we need to make sure that its descendants are > in-order. In order to do that we just need to collect them > appropriately while traversing the tree. > > BTW. I don't think this would change the complexity of the algorithm, > since we're already in k*log(n) territory. Maybe not... but it still sounds a bit expensive to me, spontaneously. -- Joakim