Web CPU Tamer

Reduzieren Sie den Energieverbrauch des Browsers durch implizite asynchrone Zeitplanung

Autor
DR LEONK
Installationen heute
27
Installationen gesamt
32
Bewertungen
0 0 0
Version
1.01
Erstellt am
15.04.2025
Letzte Aktualisierung
15.04.2025
Größe
19,5 KB
Lizenz
MIT
Wird angewandt auf
Alle Seiten

💻 Browser Energy Saver
Lower your browser’s CPU load and power usage with clever, subtle delays in JavaScript execution — seamless, frame-synced, and efficient.
What is this userscript?
Browser Energy Saver is a lightweight script designed to optimize performance and save energy. It introduces small, carefully timed async pauses before JavaScript tasks execute, allowing your browser to render smoothly, reduce heat, and operate more efficiently.
Websites often overload with timers and animation loops that clash with rendering, user input, and system processes. This script gently reduces how often those tasks fire, boosting efficiency while keeping websites fully functional.

🔑 Key Benefits:

Frame-synced task delays
The script enhances these functions:

setTimeout

setInterval

requestAnimationFrame

Each task is wrapped with two async deferrals:
queueMicrotask — yields control within the JavaScript queue

MutationObserver — waits for the next rendering cycle

This creates a delay that respects the browser’s rendering needs, giving it time to paint, layout, or cool down before heavy scripts continue.

🥷🏻 Undetectable timing tweaks

A small offset is added to delays to avoid interference from:
Brave Browser’s privacy features

uBlock Origin’s stealth scripts

Chrome’s performance throttling

This keeps the delays effective and unnoticed.

💪🏻 Robust error management

Async wrappers isolate errors and re-throw them in the next microtask, preserving stack traces for debugging and preventing silent crashes.
Modular and tidy code
Shared async logic is organized into reusable functions. Task cancellation is tracked cleanly using Sets for setTimeout, setInterval, and requestAnimationFrame.

👾 Core Features

Cuts down CPU wakeups and JavaScript overload

Extends battery life on mobile devices and laptops

Boosts responsiveness during heavy loads

Evades Brave, uBlock, and heuristic detection

Relies solely on native browser APIs

Honors task cancellation requests

Leaves webpage content and logic untouched

Safe, dependency-free, and clean

🚫 What it avoids

No ad or tracker blocking ✅

No changes to visuals, DOM, or network activity ✅

No interference with layouts, styles, or scripts ✅

Only adjusts when tasks run, not what they do ✅

💻 Where it operates

Runs automatically on standard webpages:
http://*/*

https://*/*

Excludes direct links to:
.txt, .png, .jpg, .jpeg, .gif, .xml, .svg, .manifest, .log, .ini

This ensures image viewers, text files, and static URLs remain unaffected.


🛜 Browser Support

Browser

Status

Chrome/Chromium

Fully compatible ✅

Firefox

Fully compatible ✅

Brave

Reliable (works with YouTube) ✅

Edge

Fully compatible ✅

Safari

Functional, but timing may vary slightly ⚠️

✅ Also supports:

Tampermonkey (page context)

Violentmonkey (page/content context)

Firemonkey (content context)

Stay (page context, may conflict with CSP-restricted pages)

Privacy & Security
No telemetry, trackers, or fingerprinting

No external requests or hidden analytics

Purely local, transparent logic

Licensed under MIT (open source)

🧑🏻‍🔬 Creator
DR LEVONK

🙋🏻 Async delays in the context of the Browser Energy Saver (or Web CPU Tamer) refer to a technique where small, non-blocking pauses are introduced before JavaScript tasks execute, allowing the browser to handle other critical processes like rendering or user input more efficiently. Here’s a clear breakdown:
What Are Async Delays?
Definition: Async delays are intentional pauses added to the execution of JavaScript tasks (like those scheduled via setTimeout, setInterval, or requestAnimationFrame) using asynchronous mechanisms. Unlike traditional delays (e.g., a blocking setTimeout), these don’t freeze the browser and let it continue other work during the pause.

Purpose: They reduce CPU strain by spacing out resource-heavy tasks, giving the browser "breathing room" to update the screen, respond to user actions, or cool down.

How They Work in the Script
The script uses two specific async techniques to create these delays:
queueMicrotask:
This schedules a task to run at the end of the current JavaScript execution cycle, but before the browser moves to rendering or other processes.

It’s like saying, “Finish the current job, then immediately queue this task for the next available slot.” This yields control briefly, letting the browser handle small pending tasks (e.g., event handling).

MutationObserver:
This waits for the browser’s next rendering cycle (when it updates the webpage’s visuals, like layout or painting).

By tying the delay to rendering, the script ensures JavaScript tasks don’t overwhelm the browser while it’s trying to draw the screen.

Together, these create a frame-aligned delay—a pause that syncs with the browser’s natural rhythm (typically 60 frames per second), ensuring tasks don’t pile up and clog the system.
Why Use Async Delays?
Performance: Websites often schedule too many timers or animations, overloading the CPU. Async delays slow down non-critical tasks slightly, reducing competition with rendering or input processing.

Energy Efficiency: Fewer CPU wakeups (when the processor activates to handle tasks) mean less power consumption, which extends battery life on laptops or phones.

Smoothness: By giving the browser time to render, the webpage feels more responsive—no jittery scrolling or laggy clicks.

Stealth: The delays are tiny and designed to avoid detection by privacy tools (like Brave or uBlock Origin) or browser throttling, so they work without breaking websites.

Example in Action
Imagine a website with an animation loop using requestAnimationFrame to update visuals 60 times per second. Without delays, this loop could dominate the CPU, slowing down other tasks like rendering a button click. The script wraps the loop with:
A queueMicrotask to yield control briefly within the JavaScript queue.

A MutationObserver to wait for the next render cycle.

This might add a fraction of a millisecond pause, enough for the browser to draw the button press smoothly, without the animation noticeably stuttering.
Key Characteristics
Non-blocking: Unlike a traditional setTimeout(..., 100) that pauses everything for 100ms, async delays let the browser keep working during the pause.

Frame-aware: They align with the browser’s rendering cycle, so delays don’t disrupt visual updates.

Safe: Errors in delayed tasks are caught and re-thrown cleanly, preserving website functionality and debug info.

Invisible: The delays are so subtle (often microseconds) that users and websites don’t notice any change in behavior.

Limitations
Async delays don’t stop tasks; they just adjust when they run. They won’t fix a poorly coded website that’s inherently slow.

On some browsers (e.g., Safari), timing might vary slightly due to differences in how MutationObserver syncs with rendering.

They’re designed for performance, not for altering what a website does (e.g., no ad-blocking or content changes).

In short, async delays are a clever, lightweight way to make JavaScript play nicely with the browser’s other responsibilities, improving speed and efficiency without breaking anything.

Enjoy. ☺️