Skip to content

Conversation

@Gold856
Copy link
Collaborator

@Gold856 Gold856 commented Oct 31, 2025

Description

This fixes the JSON.stringify hack used to check if the current camera settings was PlaceholderCameraSettings by using Object.freeze (this apparently allows normal equality operators to be used). This takes CPU usage down a few extra percent. One dynamically calculated class was also removed because those are also CPU-expensive (and this instance was completely unnecessary and easy to remove. Doesn't have much impact though.)

Fixes #2159.

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why
  • If this PR changes behavior or adds a feature, user documentation is updated
  • If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly
  • If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2
  • If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated
  • If this PR addresses a bug, a regression test for it is added

@github-actions github-actions bot added the frontend Having to do with PhotonClient and its related items label Oct 31, 2025
@samfreund
Copy link
Member

Is the goal here to optimize CPU usage on the client or the coprocessor?

@Gold856
Copy link
Collaborator Author

Gold856 commented Nov 1, 2025

On the client.

@Gold856 Gold856 marked this pull request as ready for review November 23, 2025 21:12
@Gold856 Gold856 requested a review from a team as a code owner November 23, 2025 21:12
@Gold856
Copy link
Collaborator Author

Gold856 commented Dec 5, 2025

Apparently whether or not my laptop is plugged in makes a huge difference in CPU usage percentage (I assume this is a relative thing and my CPU is downclocking when unplugged). When unplugged, old baseline for main is ~70%, this PR (when it removed the loading SVG from the DOM and stuffed it into an ) brought it down to ~30%, 2025.3.1 baseline is ~12%. The difference is caused by the animated Camera Matching tab when no cameras are configured.

Copy link
Contributor

@DevonRD DevonRD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@mcm001 mcm001 merged commit 9d7222a into PhotonVision:main Dec 7, 2025
42 checks passed
@Gold856 Gold856 deleted the optimize-ui branch December 7, 2025 20:25
samfreund pushed a commit to samfreund/photonvision that referenced this pull request Dec 18, 2025
spacey-sooty pushed a commit to spacey-sooty/photonvision that referenced this pull request Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Having to do with PhotonClient and its related items

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web UI maxes out cpu and freezes

4 participants