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.devel Subject: Re: [PATCH] Re: cc-mode fontification feels random Date: Tue, 31 Aug 2021 19:21:40 +0300 Message-ID: <83eea9shyj.fsf@gnu.org> References: <835yvmka50.fsf@gnu.org> <9377d9ec-a3e5-ceea-8a9a-523a420f13f7@dancol.org> <83v93lsq83.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22156"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dancol@dancol.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 31 18:22:38 2021 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 1mL6X0-0005Tm-AS for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 18:22:38 +0200 Original-Received: from localhost ([::1]:47972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL6Wy-0001PY-6b for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 12:22:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL6WG-0008Uu-9e for emacs-devel@gnu.org; Tue, 31 Aug 2021 12:21:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44282) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL6WD-0008BK-7d; Tue, 31 Aug 2021 12:21:49 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3610 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 1mL6WC-0003h3-QR; Tue, 31 Aug 2021 12:21:49 -0400 In-Reply-To: (message from Alan Mackenzie on Tue, 31 Aug 2021 16:02:45 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:273609 Archived-At: > Date: Tue, 31 Aug 2021 16:02:45 +0000 > Cc: monnier@iro.umontreal.ca, dancol@dancol.org, emacs-devel@gnu.org > From: Alan Mackenzie > > > What happens if you unleash this jit-lock-single-fontification, and > > then type at a relatively slow pace: does Emacs still feel responsive > > enough? And how much of CPU does it use in that case? > > I'm guessing at the moment Well, my point, if it wasn't clear, was to suggest that you or someone else actually try that and see what happens and how does it feel. Emacs is a complex beast, so the results might surprise us all. > but I'm reckoning that if > jit-lock-single-fontification uses (marginally over) 0.05s at a time, > followed by (at least) 0.1s break, normal typing at up to ten characters > per second shouldn't be affected. Not sure where did the 0.05 sec number come from. You want to limit the fontification of a chunk to that time, but we don't have an efficient method of doing that, because Emacs is not an interrupt-driven program. So if a Lisp program starts some heavy processing, it will only be able to stop when it gets to looking at how much time passed, or tests some flag set by a signal handler. There can be no guarantee this can never exceed 50 msec. > As for how much CPU, then I think it would use one third of a single > core's CPU time on an otherwise idle Emacs. That's 0.05s strenuous > activity followed by 0.1s break. 30% of an execution unit is not negligible. When I see something like that on my system that I presume should be idle, I start looking for an offender. And I'm not sure the 30% estimate is accurate. Once again, let's measure it.