From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Newsgroups: gmane.emacs.bugs Subject: bug#62352: Very slow scroll-down-line with a lot of text properties Date: Sat, 25 Mar 2023 13:33:53 +0100 Message-ID: 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; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26482"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Cc: 62352-done@debbugs.gnu.org To: Eli Zaretskii , Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 13:35:34 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 1pg37O-0006Tc-22 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 13:35:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg374-0002NU-FX; Sat, 25 Mar 2023 08:35:14 -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 1pg36w-0002Fp-TF for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:35:07 -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 1pg36t-0006tC-5E for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:35:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg36t-00059T-0X for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 08:35:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 12:35:02 +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.167974764919705 (code D ref 62352); Sat, 25 Mar 2023 12:35:02 +0000 Original-Received: (at 62352-done) by debbugs.gnu.org; 25 Mar 2023 12:34:09 +0000 Original-Received: from localhost ([127.0.0.1]:42054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg35x-00057g-R2 for submit@debbugs.gnu.org; Sat, 25 Mar 2023 08:34:09 -0400 Original-Received: from mail-ed1-f53.google.com ([209.85.208.53]:34541) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg35s-00057A-I8 for 62352-done@debbugs.gnu.org; Sat, 25 Mar 2023 08:34:04 -0400 Original-Received: by mail-ed1-f53.google.com with SMTP id b20so17996305edd.1 for <62352-done@debbugs.gnu.org>; Sat, 25 Mar 2023 05:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679747634; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=q+NkO59i0NEEby/EA5PxSCuNijBFmgz0Tlaj4jHPjgM=; b=qvE24uMsJbYOctOVzau5OxGuMEecThEMNxqfBiiLMdF2MDIa/Y5KjMluHytSPZ2fAU ybXe66dwrj+u9N8kL1dNVi5gZj+UlVOgG0WJyx3B0cy3hhwMXddiRhEuyGd9Dshd1hYQ CmU89t2uiGfZKGOncKxYMidkB8O0U3WLdupMBAnmjPYEPq0s3GA7gU2s07ZfZdcg9CZ0 alBVFHNZM/YBu+i8qEWPE1iFkzhYQmcqRbHUGWhwP7DZY5mSnfkTTCzTaXznNdrIPrP4 ElXYZGYenler64MkYTzvziEbJslcRbzuUIBtKeeaC48z74gdvEQGlFLcUcfcAmO9YFGi ogVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679747634; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=q+NkO59i0NEEby/EA5PxSCuNijBFmgz0Tlaj4jHPjgM=; b=O3v3f6fM6XBtxJ9qCyovP6te9OlLO/+t+vys14CYxXnU3T32xaTC3M0qKBB5xdDut5 0LCFpF4HdTbC5iU5jVNvivpQKljgBAMRNW3UP0C9RVzaPa40l0kcnc/p03TUnAKrh/vV NaTZIQyisi4OX+a2VYVhCyMn4moBz5y7MkSyKC0ooXAFPurJ69nplBuyw85aFoaNihj+ Y7Knw1rZc9wIu873oJpP3PGFPldz/Xws4yx3YOSutVJvTYy6qLy4l80OUog20LUbDUMa rbvf9788VmK9bv7HJiNTvMswhgPbX9/UoF+OQLx0hbafxdygtnWXpaTlmragMrNOSTo7 +73Q== X-Gm-Message-State: AAQBX9dHdSh84SjPzCdOMvl4Fc9BwYVW3X+tdkI9kIHRSQKGip/L/QZV nvRRx1PiWe6M3uvUuTLkAfg= X-Google-Smtp-Source: AKy350ZAMt3006wUPeKrPTRU7yLCqAOOZN+FP6KjPMHMH8GoV0XBeK8eyyfeKeA9b2frTj+1kiLOdw== X-Received: by 2002:a17:906:e112:b0:933:1b05:8851 with SMTP id gj18-20020a170906e11200b009331b058851mr5670205ejb.16.1679747634526; Sat, 25 Mar 2023 05:33:54 -0700 (PDT) Original-Received: from [192.168.8.4] (netacc-gpn-204-88-167.pool.yettel.hu. [5.204.88.167]) by smtp.gmail.com with ESMTPSA id x92-20020a50bae5000000b004fa19f5ba99sm12245736ede.79.2023.03.25.05.33.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 05:33:54 -0700 (PDT) Content-Language: sv-FI In-Reply-To: <83sfdtcab8.fsf@gnu.org> 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:258555 Archived-At: 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). With scroll-down-line, emacs freezes for 40 seconds, and when it unfreezes, it didn't even reach the top. 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. 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). On 3/25/23 12:58, Eli Zaretskii wrote: >> Date: Tue, 21 Mar 2023 21:58:05 +0000 >> From: Gregory Heytings >> cc: "Herman, Geza" , 62352@debbugs.gnu.org >> >>> However, are you saying that this is slower in Emacs 29 than it was in >>> Emacs 28? If so, bisection will be appreciated. >> FTR, I see the same behavior in Emacs 26, 27, 28 and 29 with that recipe. > That figures: the relevant code didn't see any significant changes in > the recent years. > > I also think the impression that C-n/C-p (with scroll-conservatively) > are free of this problem is inaccurate. They are a bit faster, > indeed, but in my unoptimized build I see the scroll taking almost the > same time in both cases, close to 1 sec. I think OP's impression is > based on where each of these crosses the threshold of Emacs being able > to keep up with the repeated keystrokes, and that depends on both the > auto-repeat rate and the CPU power, so it is different on different > systems. E.g., in an optimized build I see no stuttering with > scroll-down-line, either. > > So I think there's no bug here we need to look into, and I'm therefore > closing this bug report.