From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: Removing redisplay-dont-pause Date: Mon, 02 Dec 2024 05:18:25 +0100 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=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10810"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ihor Radchenko , Eli Zaretskii , mattias.engdegard@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 02 05:19:21 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 1tHxu4-0002gx-Vc for ged-emacs-devel@m.gmane-mx.org; Mon, 02 Dec 2024 05:19:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHxtK-0001rs-0O; Sun, 01 Dec 2024 23:18:34 -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 1tHxtI-0001rd-ES for emacs-devel@gnu.org; Sun, 01 Dec 2024 23:18:32 -0500 Original-Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHxtG-0002Qb-Pr; Sun, 01 Dec 2024 23:18:32 -0500 Original-Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-434a0fd9778so34648765e9.0; Sun, 01 Dec 2024 20:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733113107; x=1733717907; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EVhAKdhZgMrkvVSmCdW+mb4122Q5gbUAhL86xK8Hr8M=; b=J3f/6VO2hzhWty9QbjdgLLmqd5aqF3ypaseg/ujBEM4+XBi4xyvNmaEzMe2Gu/d7zu wsM9HIzfympvltJEJzA5NT4K9G8vC/dboWyZ7j39kacunCJPIvHhMeIrjjaw5CI6hssV 2XCCpgQgjOjL+a/QqNCLWobHaIdSMZzuNljPbeacIDNxtNZ80Jzq9zgojG/mfbM6b7xG VwQ+p2AiF+5OOPwVp4UQthaS9iRBU1dIYAd3XiGfD0VbGJ6q38HtsVVH2RPssDuSS0qU T9JAZPjalmEje75vsuSwMA3P10NZTN4UNGLdYIbylbKAViCi+dYKbd81mzw6kGJQnFtJ t0Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733113108; x=1733717908; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EVhAKdhZgMrkvVSmCdW+mb4122Q5gbUAhL86xK8Hr8M=; b=UZ7YGwXUBGgIyQ+Rficb6Mb25a6j2a81dlxrnXRgWhFuq9TZ6oMF7Le91HYZQ/Rgmn tEpUTcuae65LAHvJSXqBq6kLqEzuI+wvHKDG2ICcQO+E6Gz0VQUwrC3vufBUDRiM7fL/ J80oXJpFMGu9Sa+Oza03RpICAsbbWGkiiBWc2U2xdr3zaF4f4c8PiaDxZQdghgwkfaOv c89kcSpkDxlQRYAZx4FjT8oV++NQGUWgN8LnsrtKtmALeNsAD198rUq+4bCpIv6lS1vI VfyXxlCzEb6Mfz+RPDqXjQJrvCTVOoGcBSMXzAUg+JA1aD1CjwQuboEQlt+CgVHXEt32 K32g== X-Forwarded-Encrypted: i=1; AJvYcCUARKJwidRymX8hr2xyGIPVxFNNnyshHyFynLjJr63qHWcphA9O503J01Vnd44R7yz/mwOB4AIbQYd4zr8=@gnu.org, AJvYcCXZQ5KSjmOApyQHfRZFzNwifd5EW+v9NZGlJnD1PGvWQG++ifa7Yqc2nk3/5hPxXvtvQfbw@gnu.org X-Gm-Message-State: AOJu0Yxe3cb2OT4F71fgyB6L/Hbe3TvaGoJiQTvBUHOU+ILMAOfhc9QX c3grpil251bYe7Xn/HaDEvLe87JdHfjU57XGQ20+NxqsvRV2j1olKBR/NA== X-Gm-Gg: ASbGncs9j7ztdyYCG67pX7TFfCjftn/dwcRMb/fVfm5BCT4Ul38kdKfW//ZW9DzOySU w5gu8FuJuCY8yVVJ7hUspuUQg52Q4dYm4Of/sNW7e0UJ2+Mnn+HmiWoAwh2OIySdsGFQflsWFvU 1k+9HvRal0IOLhhrJz9og6ayOeRJUMgPwvBJpHUZ9N8OoVPOlGJPkeBsnt55axjF8isHdq1qO6v hV8ciYl2FbjjjbCb91+fL5wjjIotJqUopqUv0hItxnGAuw7XVMMDIglKzQ4tUhHVck8BvG0impv qsVWzZf9ZadpWdH8Vh0vmIQkzCzL8zAg+B3bBTc4OoszdbRLfz4MAQ== X-Google-Smtp-Source: AGHT+IGRELkI9oVYHvcyfOR3oN/rQYtQvWbFfUPb2m7En1F034q+Kdd3R5/TFGOwriVIo7toPA7rdw== X-Received: by 2002:a5d:5e83:0:b0:385:f1d9:4b90 with SMTP id ffacd0b85a97d-385f1d94d08mr2748220f8f.13.1733113107425; Sun, 01 Dec 2024 20:18:27 -0800 (PST) Original-Received: from pro2 (p200300e0b7492f00752439841d4cfe6e.dip0.t-ipconnect.de. [2003:e0:b749:2f00:7524:3984:1d4c:fe6e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385e1824ec4sm6963509f8f.108.2024.12.01.20.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Dec 2024 20:18:26 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Sun, 01 Dec 2024 21:38:42 -0500") Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=gerd.moellmann@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:325939 Archived-At: Stefan Monnier writes: >>>> 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). I think you meant to say that T3 is the phase at the end where redisplay-dont-pause is checked, the update phase that writes to the screen. T2 would then be the phase where the glyphs are produced. > > 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). The direct_output_for_insert optimization was though for that, ensuring that at least the line one types in is made visible on the screen. This comes from a time where 1200 or 2400 baud connections existed, like my first CompuServe connection in the 80s :-). That's ca, 300 bytes max. for 2400 baud. And a 80x25 screen has 2000 bytes. So, T3 could be much larger than T2, and my explanation for the fact that input was not checked during T2: it's not where the problem was. > - 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=C3=AFve mo= del > closely enough. > > > Stefan Agree, and I'd also be interested when exactly redisplay-dont-pause nil makes a difference today.