Documents current optimizations in Astro Editor. We prioritize measurement before optimization.
Cargo.toml release profile:
[profile.release]
codegen-units = 1
lto = true
opt-level = "s"
panic = "abort"
strip = truetauri.conf.json:
{
"build": {
"removeUnusedCommands": true
},
"bundle": {
"createUpdaterArtifacts": true
}
}vite.config.ts:
export default defineConfig({
build: {
sourcemap: false,
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true
}
}
}
})See performance-patterns.md for:
- Decomposed Zustand stores
- getState() pattern
- CSS visibility vs conditional rendering
- Debounced operations (auto-save: 2s)
pnpm run build
# Opens bundle-stats.html automatically (rollup-plugin-visualizer)We use rollup-plugin-visualizer configured in vite.config.ts.
Total JS: ~1.2MB minified (~350KB gzipped)
├── vendor.js: ~800KB
│ ├── React + React DOM: ~150KB
│ ├── CodeMirror 6: ~250KB
│ ├── Radix UI: ~200KB
│ └── Other: ~200KB
├── index.js: ~300KB (our code)
└── chunks: ~100KB
| Dependency | Size (min) | Size (gzip) | Status |
|---|---|---|---|
| CodeMirror | ~250KB | ~80KB | ✅ Already optimized |
| React + React DOM | ~150KB | ~45KB | ✅ Already optimized |
| Radix UI | ~200KB | ~60KB | 🔶 Could lazy-load dialogs |
| TanStack Query | ~40KB | ~12KB | ✅ Essential |
| Zustand | ~5KB | ~2KB | ✅ Minimal |
| date-fns | ~30KB | ~10KB | ✅ Tree-shakeable |
| Metric | Current | Target | Status |
|---|---|---|---|
| Bundle size (JS) | ~1.2MB | <1.5MB | ✅ Good |
| Bundle size (gzip) | ~350KB | <500KB | ✅ Good |
| Cold start time | ~1.5s | <2s | ✅ Good |
| Memory usage (idle) | ~150MB | <300MB | ✅ Good |
Measurement:
- Bundle size:
pnpm run build && du -sh dist/ - Startup time: macOS Activity Monitor
- Memory: macOS Activity Monitor → Memory column
If app grows significantly:
- Lazy load dialogs: PreferencesDialog, CommandPalette
- Virtual scrolling: If collections exceed 1000+ files
- Audit unused shadcn/ui components: Each is 5-15KB
We already follow good practices:
// ✅ Specific imports
import { Save, Folder } from 'lucide-react'
import { format } from 'date-fns'
// ❌ Don't do this
import * as Icons from 'lucide-react'
import * as dateFns from 'date-fns'- performance-patterns.md - React performance patterns
- releases.md - Build process
- state-management.md - State optimization