Skip to content

perf(transcribe): WAV load + resample peak memory ~5x recording size #5

Description

@victorlucss

Source: Performance review for v0.2.0.

`src-tauri/src/transcribe/resample.rs` — pipeline holds the raw stereo Vec, deinterleaved L+R Vecs, downmixed mono Vec, and the resampled Vec all simultaneously. For a 1 h 16-bit stereo @ 48 kHz recording that's multiple GB resident. Additionally, samples are read sample-by-sample through `Iterator<Item=Result>` and collected — slow per-sample bounds checks/allocs.

Recommendation:

  • Stream/chunk through rubato's `SincFixedIn` in slices instead of one giant `process(&[&mono], None)` call.
  • Read raw via `reader.into_inner()` chunks or `samples_iter` into a preallocated buffer with `extend`.

Touched files: `src-tauri/src/transcribe/resample.rs`, `src-tauri/src/transcribe/whisper.rs`

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfPerformance issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions