-
Notifications
You must be signed in to change notification settings - Fork 0
Performance
Flux schedules work when its sources need updating. The browser still handles rendering, media playback, input and its own housekeeping.
| Feature | Off-screen | Hidden tab |
|---|---|---|
| Time and date | Stops when neither the source nor a connected destination is visible | Stops the shared timer |
| Pointer geometry | Skips measurements for inactive bindings | Pauses frame work |
| Image and video palettes | Stops sampling when neither the source nor a destination is visible | Cancels video callbacks and pauses frame work |
| Live server updates | Stops polling when no live target is visible | Cancels the polling timer |
| Gauge example animation | Its CSS visibility condition removes the animation | Browser animation scheduling applies |
Sources read their current values when they resume. They do not replay missed clock ticks or live polls. A request already in progress may finish. Control events and observers remain attached so Flux can detect changes and elements returning to view; an attached listener does not itself create a recurring task.
Visibility means geometric viewport intersection, including clipping by scrolling containers. A covering element or zero opacity does not make a source inactive. A visible connection destination can keep an off-screen CSS source active. Without IntersectionObserver, connected sources remain active while the tab is visible.
Flux does not pause a playing video or audio track. Its palette sampler can be idle while the browser continues media playback. Custom scripts and animations also need their own lifecycle handling.
Inner updates initialise the replacement children and keep the existing root. They do not register the discarded root from the parsed response. Dialogs share a close listener and keep focus targets in a WeakMap. Removed live targets release their observer subscriptions and refresh history. CSS declarations release their last owner immediately, including while no animation frames can run in a hidden tab.
Debug logging is disabled by default. Enable it explicitly with FluxConfig.debug before loading Flux, as shown in JavaScript hooks and debugging. Browser consoles may retain logged objects independently of application references.
The repository includes a Chromium profiler in test/profile. It measures renderer task time, JavaScript duration, timer callbacks, animation frames, video callbacks, requests and retained DOM nodes after garbage collection. It switches actual browser tabs and verifies document.hidden before recording background activity.
The profiler covers the example pages, visibility changes, video playback and repeated server-rendered dialog replacements. Its sample lengths and replacement counts can be increased for longer runs. The accompanying tests cover a simulated three-day hidden interval, resumed polling, slow requests and repeated updates.
Short measurements and accelerated tests can identify accumulating references and recurring work. They cannot establish that every browser, page and third-party script will remain leak-free for several days. Measure the complete application as well as Flux, and compare retained memory after warm-up rather than expecting the process's allocated memory to remain constant.
PHP.GT/Flux is a separately maintained component of PHP.GT/WebEngine.