Skip to content

Performance improvements - #80

Merged
shovtyuk merged 17 commits into
mainfrom
performance_improve
Jun 30, 2026
Merged

Performance improvements#80
shovtyuk merged 17 commits into
mainfrom
performance_improve

Conversation

@Gummilion

Copy link
Copy Markdown
Collaborator

Performance improvements:

  1. Skip calling postMessage for StateManager parameters used for metrics overlay when metrics overlay is disabled
  2. Simplified animation for Live indicator dot; animate only when controls panel is shown

Specified override for uuid version for sockjs to to fix vulnerability warning in webpack-package example as suggested here .

Comment thread src/ui/controls.css Outdated
Comment thread src/ui/ui.js Outdated
Comment thread src/nimio-live.js Outdated
Comment thread src/nimio-live.js Outdated
Comment thread src/state-manager.js
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploying nimio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1e71b23
Status: ✅  Deploy successful!
Preview URL: https://427b6da4.nimio.pages.dev
Branch Preview URL: https://performance-improve.nimio.pages.dev

View logs

Andgoncharov
Andgoncharov previously approved these changes Jun 17, 2026
@shovtyuk

Copy link
Copy Markdown
Collaborator

@Gummilion
Please add unit coverage for the new reducePost behavior in StateManager.

The performance gain depends on suppressing state:update messages in non-SAB mode, but this is not covered by tests yet. It would be good to verify that:

  • with shared: false, port, and reducePost: true, quiet metric-only indexes do not call port.postMessage;
  • important state updates still call port.postMessage, for example STATE, CURRENT_TS, VIDEO_LATEST_TS, AUDIO_LATEST_TS, PLAYBACK_START_TS, SILENCE_USEC;
  • with reducePost: false, the metric indexes are still posted as before;
  • with metricsOverlay: true / reducePost: false, debug overlay behavior is not silently broken.

This would lock down the actual optimization path and protect against accidentally suppressing state needed for playback synchronization.

@shovtyuk

Copy link
Copy Markdown
Collaborator

@Gummilion
src/ui/ui.js: { alpha: false } should not be used for the visible canvas context. The splash screen is applied as a CSS background-image on this._canvas, and an opaque canvas backing store covers it with black. clearRect() also clears to opaque black in this mode, so the splash will not be visible on initial load / stop. Keeping { alpha: false } for the offscreen back buffer is fine, but the visible _cctx should remain transparent.

tests/state-manager.test.js: some MessageChannel assertions are currently weak. postMessageSpy tracks port1.postMessage, but several assertions after counterManager.* writes should check postMessageSpy2 or clear/check the correct spy per step. Listener mocks should also be cleared between waits/tests so assertions cannot pass from stale messages.

@shovtyuk
shovtyuk merged commit b81e961 into main Jun 30, 2026
3 checks passed
@shovtyuk
shovtyuk deleted the performance_improve branch June 30, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants