Greasy Fork is available in English.
减少YouTube影片所致的能源消耗
当前为
const UNDERCLOCK = +localStorage.cpuTamerUnderclock || 10; // default 10ms; increase to make the timer less responsive.
"UNDERCLOCK" is set at 10ms by default. You can increase it to avoid unnecessary timer callbacks.setInterval(func), setInterval(func, delay = 0), setInterval("code"), setInterval("code", delay)setTimeout("code"), setTimeout("code", delay)clearTimeout("timeoutID"), clearInterval("intervalID")setTimeout, setInterval, clearTimeout, and clearIntervalsetInterval(..., 250ms) instead of requestAnimationFrame for background running.setTimeout and setInterval functions operate. These functions are commonly used to schedule tasks and events to occur after a certain delay or at regular intervals.setTimeout and setInterval functions with custom versions that are designed to manage CPU usage more efficiently. By controlling when and how often these tasks are executed, the script can reduce CPU demand and power consumption.requestAnimationFrame function to constantly check for tasks that need to be executed. This function is specifically designed to be efficient and reduce energy consumption, making it perfect for this application.setInterval). It ensures that these tasks run frequently enough to keep the YouTube application functioning correctly, but not so often that they overload your CPU.Disable cinematic effect
To disable the cinematic effect of darker dark theme, you can click the video toolbar setting and uncheck the "Ambient Mode"Microsoft Edge - Efficiency Mode
Efficiency Mode is an active approach to reduce resources. It is useful for laptop.
If you turn on it, one major impact is that it will reduce your "animation" (including DOM rendering) refresh rate.
If you are watching videos with animated subtitles / captions, the effects will be affected especially for fullscreen playing.
nextAt now >= scheduled time + 5T.now + T (due to scheduling, rather than executing).if(o.nextAt + _interval > now) o.nextAt += _interval; else if(o.nextAt + 2*_interval > now) o.nextAt += 2*_interval; else if(o.nextAt + 3*_interval > now) o.nextAt += 3*_interval; else if(o.nextAt + 4*_interval > now) o.nextAt += 4*_interval; else if(o.nextAt + 5*_interval > now) o.nextAt += 5*_interval; else o.nextAt = now + _interval;
o.nextAt = now + _interval for now >= o.nextAt + 5*_interval o.nextAt = now + _interval >= ( o.nextAt + 5*_interval ) + _interval o.nextAt >= o.nextAt + 6*_interval t1 >= t0 + 6*T t1 - t0 >= 6T t1 - t0 <= 1000 (Timer Throtting) 1000 >= 6T T <= 1000/6 = 166.7 ms o.nextAt = now + _interval mostly for _interval < 167ms for background running with timer throtting
let baseDT = Date.now()-999999
let f1a=function(){console.log(Date.now()-baseDT, 'hello world f1a')};
let f1b=function(){console.log(Date.now()-baseDT, 'hello world f1b')};
let f1c=function(){console.log(Date.now()-baseDT, 'hello world f1c')};
setTimeout(f1a,100);setTimeout(f1a,100);setTimeout(f1a,100);
setTimeout(f1b,100);setTimeout(f1b,110);setTimeout(f1b,120);
setTimeout(f1c,100);setTimeout(f1c,200);setTimeout(f1c,300);
clearInterval(window.f1sA); clearInterval(window.f2sA);
let [f2a1,f2a2]=(()=>{
let w1=0,w2=0;let f1 = ()=>{w1++}, f2= ()=>{w2++}; setTimeout(()=>{console.log(Date.now()-baseDT, '2A' ,w1,w2);},3000);
return [f1, f2];
})();
window.f1sA=setInterval(f2a1,70); window.f2sA=setInterval(f2a2, 140);
clearInterval(window.f1sB); clearInterval(window.f2sB);
let [f2b1,f2b2]=(()=>{
let w1=0,w2=0;let f1 = ()=>{w1++}, f2= ()=>{w2++}; setTimeout(()=>{console.log(Date.now()-baseDT, '2B', w1,w2);},3000);
return [f1, f2];
})();
window.f1sB=setInterval(f2b1,5); window.f2sB=setInterval(f2b2, 10);
| Exceute the code while playing | Execute the code with paused video |
![]() | ![]() |
| Exceute the code while playing | Execute the code with paused video |
![]() | ![]() |