From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Debouncing slow mode line constructs (was: Emacs design and architecture. How about copy-on-write?) Date: Fri, 22 Sep 2023 15:52:32 +0300 Message-ID: <15c36f19-ade0-ba01-9af9-a2a8ab408dc9@gutov.dev> References: <838r92cgxp.fsf@gnu.org> <837comcam8.fsf@gnu.org> <6946e6f0-c6ef-186c-35d4-c09935c05a07@gutov.dev> <83y1h1axtq.fsf@gnu.org> <87sf79rq5o.fsf@yahoo.com> <83fs38c2yv.fsf@gnu.org> <83o7hw9ee1.fsf@gnu.org> <87il84q845.fsf@yahoo.com> <83il849bx6.fsf@gnu.org> <87a5tfri8c.fsf@yahoo.com> <878r8z27cs.fsf@localhost> <44e98df7-f683-ac07-e644-40757f1d26f9@gutov.dev> <87msxfzts6.fsf@localhost> <7b0c07f5-88c8-4f2c-6ac6-a6112c884f32@gutov.dev> <87il83zsg1.fsf@localhost> <87fs37zrjx.fsf@localhost> <83ttrn8woc.fsf@gnu.org> <87h6nmy098.fsf@localhost> 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="9963"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: luangruo@yahoo.com, acm@muc.de, incal@dataswamp.org, emacs-devel@gnu.org To: Ihor Radchenko , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 22 14:53:14 2023 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 1qjfej-0002IZ-8G for ged-emacs-devel@m.gmane-mx.org; Fri, 22 Sep 2023 14:53:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjfeK-0008Vl-Te; Fri, 22 Sep 2023 08:52:49 -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 1qjfeG-0008VW-3z for emacs-devel@gnu.org; Fri, 22 Sep 2023 08:52:44 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjfe9-0007Ty-PL; Fri, 22 Sep 2023 08:52:39 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 42D5C5C012A; Fri, 22 Sep 2023 08:52:35 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 22 Sep 2023 08:52:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1695387155; x=1695473555; bh=Z44LwDEC2WVHSTXYbYyjXGhTsC8Yv58AC9/ qgcZoSP0=; b=I15Rbsr2hEUCP+fei0dCvI0SM9307ncVrZEDs0fyx9tZzAKfFs4 65uIkYlo5GeRuSpritjrAMk4lKpqf5jIDeDwI+9GPyyKruKGHxwl/tbi9+Qrk2q0 g91CqVKpZTu2Wth5nl6lFMxulLEFAPAqGryQv+EA3s7Nrynvg6PLTB4hhCTGh8bJ Fk4tUXnSKYoxFlNrXHmfULkIy2C3LiHENyPBzYTbxEAZMpdZDnsjvo0JDjgWBLtb wM8792GLXvEfBLhZ/w0ebo3dR5bn1O5LxGS50sTz4K5vGhECc/ILA33ZyQg9r5pE kE2H2KSIqIKaZdFqzyFVoSUFSLsiLZ5n0sQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1695387155; x=1695473555; bh=Z44LwDEC2WVHSTXYbYyjXGhTsC8Yv58AC9/ qgcZoSP0=; b=XMqBYWm13Ofm1FsHjvnpu+wzQSd4N+RccquxATfVErxRpUxMjXQ 5r6mM9up6AuiCveISiZsoGDEMdx9Hh0coIlpPNJd6XPHTLrcz3C9BidfmpFAN73Z esulnZqSbkl6AsX36MyudLbTVZqIq8Auo7v5Iwa3n+S/AgK6++i5QP/beSnm25q9 edJbRDs89OpE6lbHdYUgTBgPhM5fZnVMEKbUB4Ms+BcHPbPY/04u8FJhr9TmXnBl 51FwB7+xCLa3nL3r4TrITqhMS2+oNiGl6HN01+CHrSROuM4XjTmCzw0GZ44BsNoL MFz3IR3jy0mm94mTJVs7G2G28CgFVtTEMOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudekkedgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhephfffheeljeffgeffueeghfekkedtfffgheejvdegjeettdduheeufffggfef jeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Sep 2023 08:52:33 -0400 (EDT) Content-Language: en-US In-Reply-To: <87h6nmy098.fsf@localhost> Received-SPF: pass client-ip=66.111.4.29; envelope-from=dmitry@gutov.dev; helo=out5-smtp.messagingengine.com 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, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-1.473, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:310958 Archived-At: On 22/09/2023 13:23, Ihor Radchenko wrote: > What I have in mind is the following: > > 1. Every time Emacs processes :eval construct it (a) measures the time > taken; (b) caches return value. > The total mode line render time is also recorded. > > 2. If the total render time exceeds configurable threshold, processing > the most time-consuming :eval constructs will be suspended until > "debounce" time since the last full processing. > > By "suspended", I mean that cached :eval value is reused instead of > invoking :eval again. Possibly, not reused verbatim, but by replacing > the cached value with some kind of placeholder that has the same > total height/width as the cached value. > > For example, consider :eval segment invoking external git command and > producing branch name: "⛬ master". > If that command takes too long, Emacs will display > "⏳ " instead of > "⛬ master", until the mode-line redisplay that is some fixed time > ahead. > > 3. After "debounce" time since the last "suspend", all the :eval are > processed in full again, generating up-to-date mode-line. I think it can be worth a try, although this general thing sounds easier to do (in a different way) with parallel rendering of buffers/mode-lines/etc. If we ever get to that, of course. > In terms of values, I am thinking something like 0.2 sec for threshold > and 1.0 sec for debounce. This way, mode line will be outdated no longer > than 1 second. FWIW, the "slow" mode-lines I had tried in the past were still much faster than the above.