perf(camera): avoid duplicate capture encoding#529
Closed
JustYannicc wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Why
The previous capture flow encoded the same canvas frame twice: once with
toDataURLfor preview and once withtoBlobfor saving. Data URLs also inflate memory. The new flow performs onetoBlobencode, uses that blob for both preview and save, and keeps the saved file behavior unchanged.Compatibility impact
How tested
node --test scripts/test-camera-capture-single-encode.mjstoDataURLonce andtoBlobonce.toBlobis called once andtoDataURLis not called../node_modules/.bin/tsc --noEmit --jsx react-jsx --target ES2020 --module ESNext --moduleResolution bundler --strict --esModuleInterop --skipLibCheck --lib ES2020,DOM,DOM.Iterable src/renderer/types/electron.d.ts src/renderer/src/camera-capture.ts src/renderer/src/CameraExtension.tsxgit diff --check origin/main...HEAD -- src/renderer/src/CameraExtension.tsx src/renderer/src/camera-capture.ts scripts/test-camera-capture-single-encode.mjsFull renderer typecheck was also attempted with
./node_modules/.bin/tsc -p tsconfig.renderer.json --pretty false, butorigin/maincurrently fails on unrelated renderer errors in files such assrc/renderer/src/App.tsx,src/renderer/src/components/LiquidGlassSurface.tsx, launcher hooks, Raycast runtime files, settings, and quicklink icon utilities. No camera-file errors were reported by the scoped camera typecheck above.No physical camera timing numbers were produced because this worker environment does not provide an Electron camera capture session/hardware harness. The regression test provides fresh encoder call-count validation for the performance issue.
Stack validation
codex/perf-camera-single-encode-prwas created fromorigin/main.git rev-list --left-right --count origin/main...HEADreports0 1.git log origin/main..HEADcontains only70b0e5c perf(camera): avoid duplicate capture encoding.src/renderer/src/CameraExtension.tsx,src/renderer/src/camera-capture.ts, andscripts/test-camera-capture-single-encode.mjs.