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 15:42:20 +0300 Message-ID: <83h6u9c89f.fsf@gnu.org> References: <51545b85-029c-a6ff-f733-e486f261f6c0@gmail.com> <83355x7sx2.fsf@gnu.org> <08b5f766dd5d453016a7@heytings.org> <83sfdtcab8.fsf@gnu.org> 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="32150"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gregory@heytings.org, 62352-done@debbugs.gnu.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 13:43:21 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 1pg3Ev-0008CE-2m for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 13:43:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg3Ee-0007nl-L7; Sat, 25 Mar 2023 08:43:04 -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 1pg3Ed-0007mP-6w for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:43:03 -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 1pg3Ec-0000Ly-TY for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg3Eb-0005NF-PC for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:43: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 12:43: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-done@debbugs.gnu.org id=D62352.167974817320640 (code D ref 62352); Sat, 25 Mar 2023 12:43:01 +0000 Original-Received: (at 62352-done) by debbugs.gnu.org; 25 Mar 2023 12:42:53 +0000 Original-Received: from localhost ([127.0.0.1]:42092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg3EL-0005Me-LC for submit@debbugs.gnu.org; Sat, 25 Mar 2023 08:42:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg3EC-0005MF-D9 for 62352-done@debbugs.gnu.org; Sat, 25 Mar 2023 08:42:44 -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 1pg3E4-0000EN-9E; Sat, 25 Mar 2023 08:42:28 -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=O/6e4YSmfoQqwxjcc6Ms/g0sCKs2by4ZVtadg01rHhM=; b=DqWxW2dAf+3yLVJaCdbq WUQpPzXbOrramNfxKSp2OlcsHS21vhCCe+RLCUzeHji67KmUAYcdfP1hzmgqcGMNHQRsKd+SkWj1o 3qXKc9Qx0hSiZvo3c2nzvBWIGtRclVzVJX2T2cY5k4hIbuHHWedFhW2P5XM3Kyl9BLSvqQer+ZIMi W9OC6Tf3Jl0IjFqRJol2M5VSK7TjUOoSTxAKdeDwv1ZdDDFLVj5jac19LZJwYNf0adqZuYeMGK/HQ WUqp4FEoLWmvC1Vkx7i8Un+FZVOYlzVtHfTRI/nqkjv2HlfaVZ/3gZSzkm2tP6Qm4FmllcytzsiL0 6l24x6VAqaOXkg==; 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 1pg3Dz-00019o-Hy; Sat, 25 Mar 2023 08:42:23 -0400 In-Reply-To: (message from Herman, =?UTF-8?Q?G=C3=A9za?= on Sat, 25 Mar 2023 13:33:53 +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:258557 Archived-At: > Date: Sat, 25 Mar 2023 13:33:53 +0100 > Cc: 62352-done@debbugs.gnu.org > From: Herman, Géza > > There is a behavior difference. I'm not sure what the exact reason is, > but the two different scrolls behave differently. > > With a more complex case (~250 lines, each line is 150 characters long), > I can scroll "normally" from the bottom to the top in ~5 seconds (with > scroll-conservatively=101). The scrolling stutters. If I disable > font-lock, it won't get any faster, still ~5 seconds (but fluid). Like I said: the threshold where it starts stuttering depends on many local factors. Basically, the code does a very similar job, except that in one case it needs to determine the window's starting position, while in the other it doesn't (so the jobs the code does are somewhat different). > I analyzed the issue little bit, the root cause of the slowdown is > composition handling (yet the composition feature is completely unused > by this example). > > If I comment out these lines in composition_compute_stop_pos(), emacs > works better ("normal" scrolling becomes completely fluid, > scroll-down-line still freezes, but for a much shorter time): > >   /* if (charpos < endpos */ >   /*     && find_composition (charpos, endpos, &start, &end, &prop, > string) */ >   /*     && start >= charpos */ >   /*     && composition_valid_p (start, end, prop)) */ >   /*   { */ >   /*     cmp_it->stop_pos = endpos = start; */ >   /*     cmp_it->ch = -1; */ >   /*   } */ > > It seems that emacs does a huge amount of redundant work by scanning > approximately the same area over and over again for composition properties. This is a non-starter, unfortunately: the display engine _must_ support character composition, or else some scripts will display incorrectly, and some features (like prettify-symbols-mode) will stop working. If you never need to display scripts which require character composition, turn off auto-composition-mode in your local configuration (but then expect incorrect display with some characters). > I'm not sure how it is possible that you don't see any stuttering with > scroll-down-line. On my system it freezes for seconds with my original > example (and others can also reproduce it). Get a faster computer, or make your keyboard auto-repeat rate lower?