This document explains the optimizations applied to reduce TomatoTask's bundle size.
Impact: ~2-3 MB reduction
Added aggressive release profile settings:
[profile.release]
opt-level = "z" # Optimize for size
lto = true # Enable Link Time Optimization
codegen-units = 1 # Better optimization
strip = true # Strip symbols from binary
panic = "abort" # Smaller panic runtimeImpact: ~120 KB reduction
Screenshots moved from public/captureImg/ to .github/images/ to exclude them from the application bundle. They're only needed for the GitHub README.
Impact: ~90 MB reduction (105 MB → ~10-15 MB)
Ambient sound files need to be converted from MP3 to OGG Vorbis format with optimized bitrate.
Step 1: Install ffmpeg
On Windows with Chocolatey:
choco install ffmpegOr download from: https://ffmpeg.org/download.html
Step 2: Run the Conversion Script
.\convert-sounds.ps1This script will:
- Convert all ambient sounds (birds, forest, sea, storm) to OGG Vorbis @ 64kbps
- Backup original MP3 files to
public/sounds/originals/ - Show size reduction statistics
Step 3: Test the Application
The code has already been updated to use .ogg files instead of .mp3. After conversion:
npm run devTest each ambient sound in the app to ensure they work correctly.
| Component | Before | After | Savings |
|---|---|---|---|
| Rust Binary | ~8 MB | ~5-6 MB | 2-3 MB |
| Screenshots | 120 KB | 0 KB | 120 KB |
| Ambient Sounds | 105 MB | 10-15 MB | ~90 MB |
| Total | ~113 MB | ~15-21 MB | ~92-98 MB (82-87%) |
To analyze the frontend bundle size:
npm run buildCheck the dist/ folder size and Vite's build output for detailed asset sizes.
Review package.json for unused dependencies:
npm list --depth=0Consider removing or replacing large dependencies if not essential.
The optimizations may increase build time slightly:
- LTO (Link Time Optimization): +10-20 seconds
- Size optimization (opt-level = "z"): +5-10 seconds
This is a worthwhile tradeoff for significantly smaller binaries.
- OGG vs MP3: OGG Vorbis provides better compression than MP3 at lower bitrates, ideal for ambient sounds
- 64 kbps: Perfect for ambient/background sounds where absolute fidelity isn't critical
- Browser Support: OGG is supported by all modern browsers and Electron/Tauri
- Original Files: Always kept in
public/sounds/originals/as backup
Consider for future releases:
- Lazy loading for rarely-used features
- Code splitting for different sections of the app
- Further Rust binary optimization with
upxcompression (optional) - Image optimization (SVGs are already optimal)
Made with 🍅 and optimizations!