From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.devel Subject: Re: Overlays as an AA-tree Date: Tue, 21 Feb 2017 19:26:20 +0100 Message-ID: <87r32rpfhv.fsf@luca> References: <87d1jylv43.fsf@fastmail.com> <87vasr5tqd.fsf@hochschule-trier.de> <87d1ex4kon.fsf@hochschule-trier.de> <87d1evod6x.fsf@fastmail.com> <877f53ftab.fsf@hochschule-trier.de> <878tpiqiuc.fsf@hochschule-trier.de> <87shnppspb.fsf@hochschule-trier.de> <87o9yc9v30.fsf@hochschule-trier.de> <87a89vaes3.fsf@hochschule-trier.de> <87efz7n0g5.fsf@fastmail.com> <877f4uah6i.fsf@hochschule-trier.de> <83k28u1uyz.fsf@gnu.org> <871suxs9ad.fsf@hochschule-trier.de> <837f4pxpdc.fsf@gnu.org> <877f4lls9e.fsf@hochschule-trier.de> <838tp0q3k8.fsf@gnu.org> <87vas4owus.fsf@luca> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1487701654 3485 195.159.176.226 (21 Feb 2017 18:27:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 21 Feb 2017 18:27:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Feb 21 19:27:30 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 1cgF9q-0000FJ-7W for ged-emacs-devel@m.gmane.org; Tue, 21 Feb 2017 19:27:26 +0100 Original-Received: from localhost ([::1]:47772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgF9w-0008Uf-1k for ged-emacs-devel@m.gmane.org; Tue, 21 Feb 2017 13:27:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cgF98-0008Tj-4b for emacs-devel@gnu.org; Tue, 21 Feb 2017 13:26:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cgF93-0007Np-3a for emacs-devel@gnu.org; Tue, 21 Feb 2017 13:26:42 -0500 Original-Received: from gateway-a.fh-trier.de ([143.93.54.181]:33432) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cgF92-0007Mc-Ko for emacs-devel@gnu.org; Tue, 21 Feb 2017 13:26:37 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier (RZ/HT)] Original-Received: from localhost (ip5f5bdeea.dynamic.kabel-deutschland.de [95.91.222.234]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id 889EE179ADB4; Tue, 21 Feb 2017 19:26:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1487701581; bh=EbZSsJDtBmO4fSAHXgvinDrdXDQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=Cb813AQc2e5CvuWKmp2ypVgWaAS9rWnZ4p208JRc2rehEKS7PmgHbJqpPmL+FAzYR irxEop07SdB1Y85EWGAn2cg4Xo8ye/g7sVPkwUUcdVJrP0FyThpANkAalSzB6lMels lzTcqq2DqQXswsAXaAl/ZlkH2/mMuYcrRUzcrXTE= In-Reply-To: (Stefan Monnier's message of "Tue, 21 Feb 2017 10:11:56 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 143.93.54.181 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:212530 Archived-At: Stefan Monnier writes: > BTW, in your new overlay representation, how many bytes (or words) does > an overlay cost (in the master tree, if I count right, an overlay costs > 3 Lisp_Misc objects, so that should be 3x 6words, i.e. 72 bytes on > a 32bit system)? > > I'd expect the new representation to be no larger (the current > representation has a lot of redundancy). But I'm curious because, > depending on the answer, the whole Lisp_Misc thingy might want to > be reconsidered. > I don't' know how you're counting, so here is how I (or rtags) would. #+BEGIN_SRC c /* master */ struct Lisp_Overlay { ENUM_BF (Lisp_Misc_Type) type : 16; bool_bf gcmarkbit : 1; unsigned spacer : 15; struct Lisp_Overlay *next; Lisp_Object start; /* -> 40 bytes */ Lisp_Object end; /* -> 40 bytes */ Lisp_Object plist; /* -> 40 bytes */ }; /* 40 bytes */ /* Total: 40 + 3*40 = 160 */ /* noverlay */ struct Lisp_Overlay { ENUM_BF (Lisp_Misc_Type) type : 16; bool_bf gcmarkbit : 1; unsigned spacer : 15; Lisp_Object plist; /* -> 40 bytes */ struct buffer *buffer; struct interval_node *interval; }; /* 32 bytes */ struct interval_node /* layout tweaked */ { struct interval_node *parent; struct interval_node *left; struct interval_node *right; ptrdiff_t begin; /* The beginning of this interval. */ ptrdiff_t end; /* The end of the interval. */ ptrdiff_t limit; /* The maximum end in this subtree. */ ptrdiff_t offset; /* The amount of shift to apply to this subtree. */ uintmax_t otick; /* offset modified tick */ Lisp_Object data; /* Exclusively used by the client. */ bool_bf visited : 1; /* For traversal via generator. */ bool_bf rear_advance : 1; /* Same as for marker and overlays. */ bool_bf front_advance : 1; /* Same as for marker and overlays. */ enum { ITREE_RED, ITREE_BLACK } color : 1; }; /* 80 bytes */ /* Total: 32 + 40 + 80 = 152 */ #+END_SRC -ap