Skip to content

perf(project): normalize caption words in place - #3436

Open
OptimistOtaku wants to merge 2 commits into
CapSoftware:mainfrom
OptimistOtaku:codex/perf-caption-word-normalization
Open

OptimistOtaku wants to merge 2 commits into
CapSoftware:mainfrom
OptimistOtaku:codex/perf-caption-word-normalization

Conversation

@OptimistOtaku

@OptimistOtaku OptimistOtaku commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

GPUI's Whisper and Parakeet caption paths pass owned word vectors to normalize_caption_words, which allocates a second vector and copies every retained word's text. Normalize the existing vector and strings in place, then attach punctuation before applying the existing duration cap.

This retains Unicode trimming, leading/consecutive punctuation, word order, start/end float bits, caption text, and chunk boundaries. Punctuation may still grow the preceding string. No dependencies, public API, project format, or platform-specific code change.

Measurements

Native Windows x86_64, Ryzen 5 5600H, Rust 1.88 GNU, repository release profile (opt-level=s, thin LTO). Median of nine alternating paired samples after warmups. Input batches are cloned before the timer; timings include normalization and dropping the complete output. The benchmark compares the exact upstream function against production code and checks full output equivalence before timing.

Input words Whitespace padding Before After Speedup
32 No 2.233 µs 1.623 µs 1.38×
32 Yes 2.422 µs 1.356 µs 1.79×
1,000 No 94.226 µs 66.918 µs 1.41×
1,000 Yes 86.839 µs 52.445 µs 1.66×
12,000 No 1.151 ms 0.715 ms 1.61×
12,000 Yes 1.021 ms 0.533 ms 1.92×

A second complete run also improved every case. These are normalization timings, excluding speech recognition, model loading, and UI work.

cargo test --locked -p cap-project --release --lib benchmark_caption_word_normalization -- --ignored --nocapture

Validation

  • cargo fmt --all, cargo check --locked -p cap-project
  • cargo test --locked -p cap-project: 196 library tests and four integration tests passed; five benchmarks ignored by default, new benchmark run separately.
  • cargo clippy --locked -p cap-project --all-targets -- -D warnings
  • git diff --check

Differential cases cover Unicode/ASCII whitespace, empty tokens, punctuation chains, multilingual text, signed zero, NaN/infinite times, duration clamping, rendered text, and grouping. A separate test verifies reuse of vector and string allocations. Native GPUI launch is unverified locally. Fork Actions dispatch is disabled by GitHub; upstream PR CI will provide additional platform validation.

RetriggerView in GreptileConfidence Score: 5/5

The empty CI-retry commit appears safe to merge.

Summary

The latest commit is an empty CI retry. Source files are unchanged since the previous review.

  • Caption normalization reuses its word storage without changing captions.

Reviews (2) · Last reviewed commit: "chore: retry CI after macOS runner disco..." · Reviewed by Greptile

Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:30
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@OptimistOtaku is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you get CI green? Then we'll take a look.

Copy link
Copy Markdown
Contributor Author

Thanks Richie. The failed macOS engine shard reported a runner disconnect, so I pushed a code-identical commit (c9acbc01b) to trigger fresh CI; rerunning the upstream job directly requires maintainer permissions.

The fresh engine tests, all four GPUI builds, Clippy, sync tests and recording checks have passed. The performance measurement job is still running, so I can't call CI fully green yet. The two Vercel checks also require authorization from a Cap team member. No source changes were needed for the runner failure.

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you get Greptile to 5/5 on the latest commit? Then we'll take a look.

Copy link
Copy Markdown
Contributor Author

@greptileai please review the latest commit, c9acbc0, as requested above. It is an empty CI-retry commit; the source changes are identical to the previously reviewed commit.

Copy link
Copy Markdown
Contributor Author

The fresh Greptile review is now 5/5 on the latest commit, c9acbc01b. All code checks have passed too, including the performance budget. The only remaining red checks are the two Vercel previews requiring Cap-team authorization. Thanks for taking another look.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants