Repository navigation
perf(gpui): accelerate transcription audio preparation - #3349
Open
vedanth-jadhav wants to merge 1 commit into
Open
vedanth-jadhav wants to merge 1 commit into
vedanth-jadhav wants to merge 1 commit into
Conversation
Contributor
|
Someone is attempting to deploy a commit to the Cap Software Inc Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
Preparing GPUI captions currently scans the full mixed sample buffer in the unoptimized UI crate, then creates/resamples/encodes one FFmpeg frame for every 1,024 PCM input samples. A long recording pays this cost before inference starts.
Move the unchanged, non-generic normalization routine into the existing optimized
cap-audiodependency, and use 16,384-sample batches when the PCM encoder reports no required frame size. Decode/mixing order, offsets, gain arithmetic, resampling, inference and error handling remain unchanged. This also uses the optimized normalizer when Whisper reads a standalone WAV.Measurements
Native audio-preparation reproduction, metadata read through finished WAV, not full caption generation or a timed GPUI executable. Five fresh processes per mode/workload, alternating order; Linux x86_64 AMD EPYC 9V74 host, two-CPU quota/affinity, FFmpeg 7.1.5. Every complete WAV matched baseline bytes in all 75 final comparisons.
The seconds-level normalization gain applies to the documented development optimization boundary. Shipping already optimizes that routine; the smaller shipping gain comes primarily from reducing PCM frame/packet overhead, and shipping run ranges overlap. Rust 1.88.0 native reproduction retains thin LTO, unlike GPUI dev; it reproduces optimization levels rather than the entire UI build. Raw samples, min/max ranges, source-faithful native probe, fixtures recipe and reproduction commands: benchmark evidence.
Verification and risk
cargo test --locked -p cap-audio --lib: 104 passed, 3 ignored, including five new normalization cases.cargo check, strict all-targets Clippy, workspace formatting, explicit stable/edition-2024 GPUI formatting and diff checks pass.cargo check --locked -p cap-desktop-gpui --bin cap-gpuinow passes, after updating the local dependency with Cap’s currentscripts/prepare-gpui-dependency.shpatch stack. The earlier local E0599 was caused by stale dependency patches, not an upstream source defect. Full GPUI tests and ASR inference are not claimed.The DSP formula and sample order are copied unchanged. Larger bounded PCM batches trade slightly larger temporary frames for fewer allocations/packets; all tested WAV bytes remain identical. No flushing, timeline semantics or inference changes. Checked open transcription work #2747 (timeline selection), #2814 (inference threads), and #3344 (model installation): these address separate behavior and retain the affected helpers.


Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were found.Summary
This PR speeds up audio preparation before transcription.
No actionable issues were found. Tests and builds were not run during this review.
Reviews (1) · Last reviewed commit: "perf(gpui): accelerate transcription aud..." · Reviewed by Greptile