Skip to content

perf(voice): skip strip_raw_urls in for_voice when no URL marker#646

Closed
jony376 wants to merge 2 commits into
GeniePod:mainfrom
jony376:perf/voice-lazy-url-strip
Closed

perf(voice): skip strip_raw_urls in for_voice when no URL marker#646
jony376 wants to merge 2 commits into
GeniePod:mainfrom
jony376:perf/voice-lazy-url-strip

Conversation

@jony376

@jony376 jony376 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Skips the allocating strip_raw_urls scan in for_voice when no raw URL marker is present, and elides the redundant normalize_whitespace pass 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_strip marker gate over http://, https://, and www.; strip_raw_urls runs only when a marker is present.
  • No-URL path keeps normalize_whitespace; URL-stripped path skips it because split_whitespace already collapses whitespace.
  • Removed the redundant initial text.to_string() before strip_markdown.
  • Added for_voice_corpus_regression and a clean-no-url voice_format_bench case.

Real Behavior Proof

  • I have built and run the affected code locally (or noted why I could not).
  • I have verified the change end-to-end on Jetson hardware.
  • I have NOT verified on Jetson hardware, and I explain the equivalent verification path or validation gap below.

Tested profile / hardware (check all that apply):

  • jetson
  • raspberry_pi
  • portable_sbc
  • laptop
  • mac
  • CI-only / docs-only
  • Not run locally

What I ran

No local Rust toolchain on this Windows dev machine (cargo not on PATH). Pushed branch and relied on upstream CI (cargo fmt, cargo clippy -D warnings, cargo test --features voice) for correctness proof. The for_voice_corpus_regression test and the 16 existing for_voice integration 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_voice
  • Optional Jetson: cargo test -p genie-core --features voice --release --ignored --nocapture bench_for_voice

Notes 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_urls prefixes.

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>
@github-actions github-actions Bot added the performance performance improvement, but not verify on jetson label Jul 6, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>

@matedev01 matedev01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks — but this is voice-runtime-internal perf, out of the M2 scope (portable providers + channel boundaries). Closing as out-of-scope.

@matedev01 matedev01 closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance performance improvement, but not verify on jetson

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(voice): skip for_voice strip_raw_urls when no URL marker

3 participants