perf: compress embedded espeak-ng-data with rust-embed#62
Closed
pszymkowiak wants to merge 2 commits into
Closed
Conversation
Swap include_dir for rust-embed with the 'compression' feature. The embedded files were uncompressed phoneme dictionaries (~15 MB plain text/binary), DEFLATE typically gives 4-5x on this content. Expected release binary drop: ~50 MB to ~32 MB, tarball ~22 MB to ~13 MB. UX unchanged: first piper run still extracts to ~/.config/vox/piper/espeak-ng-data and sets PIPER_ESPEAKNG_DATA_DIRECTORY. The sentinel file logic short-circuits on subsequent runs.
Contributor
Author
|
Closing — rust-embed v8's Per the analysis in #59, a 50 MB Rust ML CLI binary is within the 2026 norm (ruff ~30 MB, bun ~60 MB, deno ~85 MB) and the curl-install UX is unaffected. Keeping the simpler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #60. The embedded
espeak-ng-datadirectory was shipped uncompressed viainclude_dir!, inflating the release binary from ~27 MB (pre-fix) to ~50 MB. The bytes are mostly phoneme dictionaries — plain text and small binary tables that compress well.Swap
include_dir = "0.7"forrust-embed = { version = "8", features = ["compression", "interpolate-folder-path"] }. Files are DEFLATE-compressed at build time and decompressed when extracted (once, on first piper call). Expected sizes:Same staging path (
$OUT_DIR/espeak-ng-datapopulated bybuild.rs), same first-run extraction to~/.config/vox/piper/espeak-ng-data/, samePIPER_ESPEAKNG_DATA_DIRECTORYenv-var dance. No user-facing change.Test plan
vox -b piper "hello"on a fresh~/.config/vox, confirm extraction + audio works