From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#58158: 29.0.50; [overlay] Interval tree iteration considered harmful Date: Fri, 30 Sep 2022 19:04:05 +0300 Message-ID: <83v8p4df2i.fsf@gnu.org> References: <83h70qhez0.fsf@gnu.org> <83edvuhaby.fsf@gnu.org> <831qruh67o.fsf@gnu.org> <83y1u2foli.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12365"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, mail@andreas-politz.de, 58158@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 30 18:06:19 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 1oeIWp-00032G-6d for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 18:06:19 +0200 Original-Received: from localhost ([::1]:49482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeIWn-00067C-Kb for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Sep 2022 12:06:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeIVb-00065J-2d for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 12:05:17 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43636) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeIVZ-0005wU-RF for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 12:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeIVZ-0003SB-IB for bug-gnu-emacs@gnu.org; Fri, 30 Sep 2022 12:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Sep 2022 16:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58158 X-GNU-PR-Package: emacs Original-Received: via spool by 58158-submit@debbugs.gnu.org id=B58158.166455387113235 (code B ref 58158); Fri, 30 Sep 2022 16:05:01 +0000 Original-Received: (at 58158) by debbugs.gnu.org; 30 Sep 2022 16:04:31 +0000 Original-Received: from localhost ([127.0.0.1]:42713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeIV5-0003RP-33 for submit@debbugs.gnu.org; Fri, 30 Sep 2022 12:04:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeIV1-0003RA-2S for 58158@debbugs.gnu.org; Fri, 30 Sep 2022 12:04:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:33770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeIUt-0005sr-AF; Fri, 30 Sep 2022 12:04:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=IcoRPEpT9fs4zTvRlng1X9GbLgtEMJViCg64KeEmRp8=; b=OIQA3AdwfLZz qtU9O0zqa04/t5TZJClxIRDV6XYCRiG8R4HYBHVi3M5bQKfwFuiSpaMKWoqUqYvTxaq6RibzW/VNT F5BLG6ekvqXy0HHSfTQKf6JzIJWNsQWka/sBuPMgj2Y2DPMF1KOyOoSikVHxUp+9FdBPffykkmYcs 8RJ3slU/z1S5g22ExMF0mxEyzj4wx3rUcHYLjmEHzdBY1Pa9XRRGeB6Y3n+GBJSWZwwzeaYUZuuqr wpJUBuhxAA6u4b+FqTMXrEtuSUy46jUsDrqA2JXT9C8SKZPc1AU4pCIZq+kUOJFwyiw4oMQFF+ejO EGlb4r9Qc7YGnkv2Ahq1Pw==; Original-Received: from [87.69.77.57] (port=3065 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeIUs-0004nQ-DJ; Fri, 30 Sep 2022 12:04:18 -0400 In-Reply-To: (message from Stefan Monnier on Fri, 30 Sep 2022 11:25:30 -0400) 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:244031 Archived-At: > From: Stefan Monnier > Cc: Eli Zaretskii , 58158@debbugs.gnu.org, Andreas Politz > > Date: Fri, 30 Sep 2022 11:25:30 -0400 > > > And, perhaps, if it doesn't order duplicates, would it be an idea to > > order them, maybe at some later point? I'm asking this because > > a successor(N) function would return nodes in the order in the tree, > > always, and I don't know what the order is now. > > Ordering based on interval end could arguably make sense. I'm not > completely sure how/where it would benefit us, tho. Most times we look > at the itree, we just look at *all* the nodes within a specific > interval, so the order in which they're returned doesn't matter very > much (the ordering within the tree does matter in terms of how we manage > to prune the tree, but that has more to do with which elements are near > the root, which is a different kind of "ordering" than the "binary tree > ordering" itself). Maybe the `next/previous-overlay-change` code > benefit from sub-ordering based on `end`, but I suspect the effect would > be lost in the noise: if we want to speed up that part of the code, > I expect that a better avenue is to rewrite the > `next/previous-single-overlay-change` so as not to work by (while .. > (next/previous-overlay-change ..) .. (get-char-property ..) ..) where > both functions do the O(log N) itree-iteration dance, but instead doing > the itree iteration itself. The display engine sorts the overlays, so order could be important.