From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Removing redisplay-dont-pause Date: Sun, 01 Dec 2024 21:38:42 -0500 Message-ID: References: <86ed3awd16.fsf@gnu.org> <86v7w582ms.fsf@gnu.org> <9E402D0E-43D9-458F-8C51-043F9F398DD9@gmail.com> <86bjxv67ha.fsf@gnu.org> <874j3nr8d6.fsf@localhost> <865xo35uwe.fsf@gnu.org> <871pyrqwyz.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2795"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , mattias.engdegard@gmail.com, emacs-devel@gnu.org, gerd.moellmann@gmail.com To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 02 03:39:56 2024 Return-path: Envelope-to: ged-emacs-devel@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 1tHwLr-0000aF-VT for ged-emacs-devel@m.gmane-mx.org; Mon, 02 Dec 2024 03:39:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHwKz-0007cC-6D; Sun, 01 Dec 2024 21:39:01 -0500 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 1tHwKs-0007bn-9h for emacs-devel@gnu.org; Sun, 01 Dec 2024 21:38:54 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHwKm-0005ha-4h; Sun, 01 Dec 2024 21:38:54 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A4ECC806DE; Sun, 1 Dec 2024 21:38:44 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1733107123; bh=PYYPOw9sz1qyrX6bmSbGNtVba0iooP+8IVgNbRNZOz8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=gUp3CMdFKeEtX3DmEdNZGCUsVjPbI8aa13yXabOybDR1jybjd/dcj9yWr68TCt43j 03KNgek+YfTiZkOJysi07tuZIcbeD8MW7W0PsWDp1YwwXhB1mATAN9eLvfwUVDQ5zb pF8GP1aJ6V0qmOs4cAuZ8nmoBsbqagZxyBD8qln+7Vk0potAHzHkXcXVDOkd0ULnAp G1aze61ESndTldM5Sw8XJcxHAzCYvQB2qFz2cK7f+SWVZfhizau7UG8PpqTnB03Fgz 5io5KbQFwqW6lcoy0Z1dSM1La4oCNrgrDKg7qS1XOUiYN7DMUBHx7yJrFejZBtlOIL dOSPUo/Bvu/OA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A10AE80318; Sun, 1 Dec 2024 21:38:43 -0500 (EST) Original-Received: from alfajor (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5D671120129; Sun, 1 Dec 2024 21:38:43 -0500 (EST) In-Reply-To: <871pyrqwyz.fsf@localhost> (Ihor Radchenko's message of "Sun, 01 Dec 2024 14:49:56 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325934 Archived-At: >>> The problem with redisplay hangs keeps surfacing again and again, so I >>> do expect that a number of people will try to use it as soon as they >>> learn that such variable exists. >> >> The hangs you have in mind cannot be helped by this variable. > > I was replying about your example with scrolling. I also tested setting > this variable when typing in an Org buffer with many large invisible > regions, and setting the variable does help typing speed. If you can come up with a reproducible recipe, I'd be interested to see it, since in most cases, `redisplay-dont-pause =3D=3D nil` tends to make things worse, IME. The way I think about it is as follows: Assume the incoming events come every T seconds and take T1 seconds to run, and the subsequent redisplay takes time T2+T3 (where T2 is the time in the middle where `redisplay-dont-pause` is consulted). Then you have the following scenarios: - If T > T1+T2+T3, then all is well. - If T < T1, then we plain and simply can't keep up at all, the redisplay is just not run at all and incoming events keep accumulating as we fall ever further behind the incoming events until the incoming events stop (at which point Emacs will only refresh its redisplay after it has finally caught up with the buffered input). - If T1 < T < T1 + T2, then Emacs will keep up with the input (i.e. when the events stop coming, the display is refreshed more or less instantly) but with `redisplay-dont-pause` set to nil it will not refresh the display at all until the incoming events stop because every time it tries to redisplay it gets interrupted by some new input. If OTOH `redisplay-dont-pause` is set to t, then instead of aborting the redisplay, we finish it which slows us down (gets us a bit further behind the flow of input), but does give feedback to the user, and for the next few inputs we'll simply perform no redisplay at all until we caught up with the input, at which point we will again perform a redisplay, so in the end we get a redisplay after every N events where N =3D (T2 + T3) / (T - T1). - If T1 + T2 < T < T1 + T2+ T3, the difference between the settings of `redisplay-dont-pause` is smaller (in both cases, the display is refreshed every once in a while), but there will still be fewer redisplays when `redisplay-dont-pause` is nil because we waste time starting some redisplays which we later abort. Of course, reality is more complex (e.g. the time T2 is not a constant, e.g. it can occasionally be proportional to the number of events since the last redisplay), but at least in my tests where we scroll down a buffer with a high repeat rate, the behavior matched that na=EFve model closely enough. Stefan