From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#56682: Interval tree balance (was: Fix the long lines font locking related slowdowns) Date: Sun, 24 Jul 2022 10:34:25 -0400 Message-ID: References: <837d46mjen.fsf@gnu.org> <174616cd5c33bfc14b1f@heytings.org> <837d44jr4p.fsf@gnu.org> <83bktghrn0.fsf@gnu.org> <87v8rnc2wp.fsf@gmail.com> <8335erizqh.fsf@gnu.org> <83r12bhgfo.fsf@gnu.org> <83pmhvhg7g.fsf@gnu.org> <83o7xfhfqw.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40678"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56682@debbugs.gnu.org, Eli Zaretskii , gregory@heytings.org, visuweshm@gmail.com To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 24 16:35:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1oFchQ-000APG-E7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Jul 2022 16:35:16 +0200 Original-Received: from localhost ([::1]:43806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oFchP-0004dH-5y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Jul 2022 10:35:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFchC-0004bl-7J for bug-gnu-emacs@gnu.org; Sun, 24 Jul 2022 10:35:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oFchB-0001th-Ud for bug-gnu-emacs@gnu.org; Sun, 24 Jul 2022 10:35:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oFchB-0007L3-Nc for bug-gnu-emacs@gnu.org; Sun, 24 Jul 2022 10:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Jul 2022 14:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.165867327928175 (code B ref 56682); Sun, 24 Jul 2022 14:35:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 24 Jul 2022 14:34:39 +0000 Original-Received: from localhost ([127.0.0.1]:48434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oFcgp-0007KM-BQ for submit@debbugs.gnu.org; Sun, 24 Jul 2022 10:34:39 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oFcgo-0007K8-Bo for 56682@debbugs.gnu.org; Sun, 24 Jul 2022 10:34:38 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DD7438005E; Sun, 24 Jul 2022 10:34:32 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 53E7F80543; Sun, 24 Jul 2022 10:34:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1658673267; bh=ptyoh5XPR4jp3BR+H35k/HRUVKaq0jlj4P3g7SgzHFw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lH+EnAQrgahdK1r62SS95X1cKNDbcosDZN7MOLLOjHwt+Iy6Jp+++4LXE5lYXMmXV bOW1vgueSzDxaAIz6S5BLtdi3plccOioG9iyh/42nD9rREuYMvIvbQSnkPMqBlJGTB OuRPE0VhRjC91tz18tThh6o2DpofZ6fV+CiQSiLkIFwAMP8qXJXcL28al6HYRHB7iI rCV9dCbtUZri5uvahmLo840qinA2PRrH4vlsidLVModMCVX7X0K0wq7gRdHUYUmc5i LO8HXX5nLz1P/B+qaRNCrOOTBhAoYeqUToSO5mJp7MefnkA//1XaEQIFJDpVcPTHKn L3ZTYqlzpCr3g== Original-Received: from pastel (unknown [45.72.195.111]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 14BAF120172; Sun, 24 Jul 2022 10:34:27 -0400 (EDT) In-Reply-To: ("Gerd =?UTF-8?Q?M=C3=B6llmann?="'s message of "Sun, 24 Jul 2022 08:16:33 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:237839 Archived-At: > Don't know if this is relevant for anything in this case. I thought I > just mention that the interval tree might also have a potential for > improvement, if you will. And another BTW: I was never 100% certain if > the interval tree is really always balanced because it didn't use an > algorithm that I knew and could recognize. I can answer this one: no it's not always balanced (tho in practice it is most of the time). We could make it use a more standard algorithm, but I have not been able to measure any impact on performance (I also played with a splay-tree alternative, under the assumption that we mostly consult the tree "locally" (within the visible part of the buffer, basically), so a splay-tree could turn the O(log N) into an O(n) where `N` is the buffer-size and `n` is the distance between window-start and window-end). Stefan