Skip to content

perf: move the mel buffer into the 1-item MelBatch instead of copying it - #67

Merged
mudler merged 1 commit into
mudler:masterfrom
sylvestre:move-mel-batch
Sep 26, 2026
Merged

mudler merged 1 commit into
mudler:masterfrom
sylvestre:move-mel-batch

Conversation

@sylvestre

@sylvestre sylvestre commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

encode_16k and transcribe_16k_ctc_logits both assigned feats to mb1.data by copy. That branch is the long-audio path, where feats is n_mels * T floats (tens of MB for minutes of audio), so the copy doubles peak mel-buffer footprint for exactly the inputs where memory is tightest.

feats is dead after the assignment on that branch: it is only read again by the encoder.forward() call in the else branch.

Found by Coverity (COPY_INSTEAD_OF_MOVE) running over the copy of parakeet.cpp vendored in Firefox.
https://bugzilla.mozilla.org/show_bug.cgi?id=2069578

Assisted-by: Claude:claude-opus-5 [Claude Code]

encode_16k and transcribe_16k_ctc_logits both assigned feats to mb1.data by
copy. That branch is the long-audio path, where feats is n_mels * T floats
(tens of MB for minutes of audio), so the copy doubles peak mel-buffer
footprint for exactly the inputs where memory is tightest.

feats is dead after the assignment on that branch: it is only read again by
the encoder.forward() call in the else branch.

Found by Coverity (COPY_INSTEAD_OF_MOVE) running over the copy of
parakeet.cpp vendored in Firefox.

Signed-off-by: Sylvestre Ledru <[email protected]>
Assisted-by: Claude:claude-opus-5 [Claude Code]
@mudler
mudler merged commit c79ab44 into mudler:master Sep 26, 2026
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.

2 participants