emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: cc-mode fontification feels random


From: Alan Mackenzie
Subject: Re: [PATCH] Re: cc-mode fontification feels random
Date: Tue, 31 Aug 2021 16:02:45 +0000

Hello, Eli.

On Tue, Aug 31, 2021 at 16:23:08 +0300, Eli Zaretskii wrote:
> > Date: Tue, 31 Aug 2021 10:54:23 +0000
> > Cc: Daniel Colascione <dancol@dancol.org>, Eli Zaretskii <eliz@gnu.org>,
> >   emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > For my current project (finding CC Mode "found types") stealth
> > fontification is not ideal - what I need is a single pass through the
> > whole buffer to detect the types, and that should be as fast as
> > possible.  The current stealth fontification is not fast (it doesn't
> > need to be) and carries on working until Emacs is shut down.

> The purpose of jit-lock-stealth is different, that's why.

> > So, it seems I want something like stealth, but not quite.

> Yes, you want a different feature.

> > How about, say jit-lock-single-fontification - it would apply to
> > individual buffers only, would scan through the buffer precisely
> > once, and would do just enough 500-byte chunks at at time to take
> > 0.05 seconds (configurable).

> > On my machine in C Mode, approximately 100 chunks are fontified per
> > second.  So if we had jit-lock-single-nice at 0.1 seconds, the time
> > taken to scan xdisp.c would be approximately 1 to 1.5 minutes.  On a
> > smaller file, say syntax.c (a tenth of the size) it would take 5 - 10
> > seconds.  This is barely worse than context fontification, and would
> > only happen at mode start up.

> 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, 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.  Am I being optimistic here?  I think
you said in another post that your system's response with stealth
sometimes is "under a second".  That sounds like "not very much" under a
second, which is sluggish and something we want to avoid.

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.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]