emacs-devel
[Top][All Lists]
Advanced

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

Re: jit-lock-stealth-load


From: Stephen Gildea
Subject: Re: jit-lock-stealth-load
Date: Sun, 24 Mar 2002 21:10:09 -0500

>   I wonder if there is some way we can make jit-lock gradually
>   reduce its activities as the load moves above 100, turning off
>   when it gets to around 150 or 200.

This appeals to me, because the load reported to jit-lock is of course a
moving average, and one wants jit-lock to respond to instantaneous load.
But I would want it to gradually reduce activity much earlier, turning
off completely at 100.  The magic number is still 100%.

How about something like this:  jit-lock notes the current time, and
does a chunk of a buffer.  Then it notes the time again and adjusts
its chunk size to try to keep its compute time constant, say 0.1 second.
This keeps Emacs responsive on all speeds of CPU.  Then it checks the
load.  If we are at or above the limit, sleep for 30 seconds and check
the load again.  If we are below the limit, sleep for

 d*(a - n)/(m - a)  with a min of 0 secs and a max of 10 secs.

where m is jit-lock-stealth-load (default *still* 100)
      n is the point at which we start backing off (normally m-100)
      a is actual system load average
      d is the time it took to do the last chunk

This makes Emacs contribute just enough load to drive the system load
towards the limit, backing off as we get close.  The value of n is m-100
because Emacs can contribute at most a load of 100%.  If the actual load
is less than m-100, then Emacs cannot raise it to m even by running
continuously; above m-100, Emacs might need to back off to avoid
overshooting m.

But this would complicate the code, and I'm plenty happy with the
current, simple algorithm and jit-lock-stealth-load set to 100.

 < Stephen



reply via email to

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