From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: noverlay branch Date: Tue, 11 Oct 2022 14:59:49 -0400 Message-ID: References: <87sfjzefvv.fsf@rfc20.org> <875ygt6gbj.fsf@rfc20.org> <87pmf04c7s.fsf@rfc20.org> <87sfjvvx7g.fsf@rfc20.org> <87fsfuw85t.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15484"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Matt Armstrong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 11 21:04:02 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiKXp-0003jg-7R for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 21:04:01 +0200 Original-Received: from localhost ([::1]:41722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiKXn-0000BK-Va for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 15:04:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiKU3-0006RU-7g for emacs-devel@gnu.org; Tue, 11 Oct 2022 15:00:07 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29025) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiKU0-0001TE-FZ for emacs-devel@gnu.org; Tue, 11 Oct 2022 15:00:06 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BF10980784; Tue, 11 Oct 2022 14:59:59 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 0B2648027D; Tue, 11 Oct 2022 14:59:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1665514798; bh=F5ORBKXhuI2/MKNui9zM5TvrWgMf+nyHub97q/9v1qc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aO/poNm+zK467/o54FHB71aVTbJQ7lCmPzvQtmwFo07a9EdxDXbUYz4em7P2ENs2W DuRIv/cq+i3aVWXK0HwVhKtMU9x0TmluULh/7HfSDdvyevGnbpcOHJOZYijbHR3HSW 9O83NcwzVU6QLf6JgTj3XAlgPoCVcT+nKZ35g4aXxvy1mV8zn1p3SMrbmeMLgNlllD kDNTQ3YY07IC8FCWVU7CzZWH9SGE6lM1xYXN/QM3iHoDpwTNIoMWPveUEp/4C0rIJ7 i9XITZ9bmibSq+0jXFmj1ytpfOxnfcSiktgun8wI2L3Twe+VyCI25fgzT0ATTqTNQZ BEL6kynRFd2YA== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EE37212014D; Tue, 11 Oct 2022 14:59:57 -0400 (EDT) In-Reply-To: <87fsfuw85t.fsf@rfc20.org> (Matt Armstrong's message of "Tue, 11 Oct 2022 11:02:22 -0700") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297527 Archived-At: >>>> Regarding `otick`, I can see 2 more options: >>>> - Get rid of it completely: its sole purpose is to try and keep >>>> `overlay-start/end` O(1) in the usual case instead of O(log N), but >>>> I'm not convinced it's worth the cost of propagating `otick` everywhere >>>> all the time. >>>> - A halfway point is to keep `otick` but update it more lazily, >>>> i.e. only update it when we do `overlay-start/end` (e.g. in >>>> `interval_tree_validate`). >>> These ideas are simpler but similar in direction to my idea to use a >>> btree instead. >> Sorry, I fail to see the connection to btrees. > Just a performance conjecture. A b-tree is shallower, so your first > idea above is more attractive. I still fail to see the connection: changes in `otick` need to be propagated everywhere anyway, so the shape of the tree probably doesn't make much difference. [...time passe...] Oh, I think you're talking specifically about the complete removal of `otick` where a shallower tree would make that less costly. Sorry. I understand quickly, but only after a long explanation. >> [ FWIW, I'd like to get rid of the `tree->size` field, and thus rely on >> auto-growing more heavily. ] > I rather like the size field. I agree it has its benefit, which is why I haven't removed it yet: I'm not sure. > I have a different idea about the stacks, though. Idea: use fixed size > stacks, no auto-growing. 120 elements is all that is needed (the max > possible depth of a 3-pointer red-black tree on 64 bit architectures). > That is 1K memory overhead per traversal, which I think isn't an issue? > At least, this is a reasonable choice in other systems I've worked in. > Is it reasonable for Emacs? Maybe you're right. I think this decision is muddled by the (ab)use of stacks as collections of nodes at a few places (where we use `interval_stack_push`), where it's not limited to O(log N). Stefan