perf(voice): skip strip_raw_urls in for_voice when no URL marker#646
Closed
jony376 wants to merge 2 commits into
Closed
perf(voice): skip strip_raw_urls in for_voice when no URL marker#646jony376 wants to merge 2 commits into
jony376 wants to merge 2 commits into
Conversation
Gate the allocating raw-URL token scan on http/https/www markers so common spoken replies without URLs skip the pass entirely. Elide the redundant normalize_whitespace allocation on the URL-stripped path because split_whitespace already collapses runs. Added a for_voice regression corpus and a clean-no-url microbench case. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
matedev01
reviewed
Jul 6, 2026
matedev01
left a comment
Contributor
There was a problem hiding this comment.
Thanks — but this is voice-runtime-internal perf, out of the M2 scope (portable providers + channel boundaries). Closing as out-of-scope.
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.
Summary
Skips the allocating
strip_raw_urlsscan infor_voicewhen no raw URL marker is present, and elides the redundantnormalize_whitespacepass on the URL-stripped path. Most spoken replies avoid one to two buffer allocations per call while preserving byte-identical TTS text.Fixes #645
Changes
needs_raw_url_stripmarker gate overhttp://,https://, andwww.;strip_raw_urlsruns only when a marker is present.normalize_whitespace; URL-stripped path skips it becausesplit_whitespacealready collapses whitespace.text.to_string()beforestrip_markdown.for_voice_corpus_regressionand aclean-no-urlvoice_format_benchcase.Real Behavior Proof
Tested profile / hardware (check all that apply):
jetsonraspberry_piportable_sbclaptopmacWhat I ran
No local Rust toolchain on this Windows dev machine (
cargonot on PATH). Pushed branch and relied on upstream CI (cargo fmt,cargo clippy -D warnings,cargo test --features voice) for correctness proof. Thefor_voice_corpus_regressiontest and the 16 existingfor_voiceintegration tests guard byte-identical output.What I observed
Awaiting CI on push. Prior merged perf PRs (#608, #643) validated the CI-only path on this repo.
Test plan
cargo test -p genie-core --features voice for_voicecargo test -p genie-core --features voice --release --ignored --nocapture bench_for_voiceNotes for reviewers
Complements #483 (single-pass helpers inside each stage). This PR targets the outer pipeline: skipping whole stages on the common no-URL path. The marker set is a conservative superset of the
strip_raw_urlsprefixes.