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#62352: Very slow scroll-down-line with a lot of text properties Date: Sat, 25 Mar 2023 20:49:54 +0300 Message-ID: <83ileobu0t.fsf@gnu.org> References: <51545b85-029c-a6ff-f733-e486f261f6c0@gmail.com> <83355x7sx2.fsf@gnu.org> <08b5f766dd5d453016a7@heytings.org> <83sfdtcab8.fsf@gnu.org> <83h6u9c89f.fsf@gnu.org> <834jq9c4kb.fsf@gnu.org> <83pm8wby5e.fsf@gnu.org> <38eca973-0d1b-cd3b-1602-00d22c8c1afe@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24639"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62352@debbugs.gnu.org, gregory@heytings.org To: geza.herman@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 18:51:18 2023 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 1pg82w-000628-1l for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 18:51:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg82m-00063n-LW; Sat, 25 Mar 2023 13:51:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg82g-000639-Gn for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:51:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg82f-00079W-Lh for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg82f-0008IU-Hf for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:51: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: Sat, 25 Mar 2023 17:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62352 X-GNU-PR-Package: emacs Original-Received: via spool by 62352-submit@debbugs.gnu.org id=B62352.167976660831832 (code B ref 62352); Sat, 25 Mar 2023 17:51:01 +0000 Original-Received: (at 62352) by debbugs.gnu.org; 25 Mar 2023 17:50:08 +0000 Original-Received: from localhost ([127.0.0.1]:43434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg81n-0008HM-GK for submit@debbugs.gnu.org; Sat, 25 Mar 2023 13:50:07 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg81k-0008Gh-S5 for 62352@debbugs.gnu.org; Sat, 25 Mar 2023 13:50:05 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg81d-0006ha-C0; Sat, 25 Mar 2023 13:49:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=xsUb3a1Or0Zm4/EapgdfsFRm4ntu1Oro1YySMXocG2Y=; b=VpWOr58W1c6S9+y7C5YY XiU7at5GLUlz4Osce3KbiJgoE2wreY3eu6tZT/VOjc6rBVPeFErWQaqwuOFrRWTDEJJbMV0y5WZnP OaiPf1a7ikeW8qUkmMLtV3nSKlDAHFcT9oasueQdShJNdHNH2cy7EvXdVOAOb+xtlix+v2R4nCQQ3 GqOA8LKxxy0KAIjRkyVymI1LGbGS9MlJqEqA2DlZFmTdmfGid++6egtiXsVxE8lcbwR8yLMLZl6Lc 5wHezI3mV9JXrhuAfq+Vco0xhb5gl31o2Xa2zmsUaVYCg7tsJl77ZDed/SZKXYQIZTC4XFZpM2M+l tEvAF1vEjTin3g==; Original-Received: from [87.69.77.57] (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 1pg81c-00072V-Pc; Sat, 25 Mar 2023 13:49:57 -0400 In-Reply-To: <38eca973-0d1b-cd3b-1602-00d22c8c1afe@gmail.com> (message from Herman, =?UTF-8?Q?G=C3=A9za?= on Sat, 25 Mar 2023 18:38:19 +0100) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258611 Archived-At: > Date: Sat, 25 Mar 2023 18:38:19 +0100 > Cc: gregory@heytings.org, 62352@debbugs.gnu.org > From: Herman, Géza > > > IOW, it is not as simple as you seem to think. > I didn't meant to imply that it is easy. It is certainly not. But, tbh, > while emacs is fluid most of the time, it can be very stuttery > sometimes. In my experience, this is usually caused by some lisp code. > But when it isn't, it is usually caused by some code in this area. When > I profile emacs, these functions (next_property_change and similar) are > usually on the top of the list. So it would make sense to optimize > around this area. Not just because of this issue, but in general. > > I'm not necessarily suggesting a cache. Maybe it's better to actually > always manage additional data structures. So, if a text property is > added, it's not just set for the specific character area, but it will > also modify search structures right away. So additional data structures > were always in sync. Sure, it has some overhead. But if emacs does a lot > of linear searches (and having a look at these functions, I see a lot of > linear searches), this overhead will be quickly mitigated by the much > faster searches. For example, if emacs had a list which only contained > text segments with the composition property, the current 500-char area > search will be much faster. Emacs already handles text properties using an efficient data structure, see intervals.c. Feel free to suggest improvements to the algorithms we use there.