Conversation
Implements a `startFrame` parameter in `JsPreprocessor.computeRawMel` to allow skipping computation of frames that are already cached. Updates `IncrementalMelProcessor` to leverage this, skipping STFT and mel filterbank operations for the cached prefix of the audio. Performance benchmark (5s audio, 3.5s overlap): - Before: ~79ms - After: ~27ms (~2.9x speedup) Tests: - Verified correctness with existing test suite (70 tests passed). - Confirmed bit-exact output matches full computation. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Handled in PR#34 (release branch). Closing superseded PR. |
Understood. Acknowledging that this work is now obsolete and stopping work on this task. |
⚡ Bolt: Optimized IncrementalMelProcessor to skip redundant STFT computations
💡 What:
Modified
JsPreprocessor.computeRawMelto accept astartFrameparameter.Updated
IncrementalMelProcessor.processto pass the number of safe cached frames asstartFrame, avoiding re-computation of the STFT for the overlapping prefix.🎯 Why:
The previous implementation re-computed the STFT for the entire audio buffer even when ~70% of it was already cached and would be overwritten anyway. This was a significant bottleneck in streaming applications.
📊 Impact:
🔬 Measurement:
Run
tests/mel.test.mjsand observe the "should process incrementally faster than full" benchmark output, or run a dedicated benchmark script. Existing tests ensure no regression in accuracy.PR created automatically by Jules for task 16657204577315940198 started by @ysdede
Summary by CodeRabbit
Performance
Refactor