perf: 580x faster embedding init - separate model from WASM
Cloud Run cold starts taking 139 seconds due to 90MB WASM file with embedded 87MB model weights. WASM compilation scales with file size. Solution: Split into 2.4MB WASM (code only) + external model files. - WASM compile: 139,000ms → 6-8ms - Model load: N/A → 30-115ms - Total init: 139,000ms → 136-240ms New modelLoader.ts handles all environments: - Node.js: fs.readFile() - Bun: Bun.file() - Bun --compile: auto-embedded assets - Browser: fetch() Zero config - same API, npm package includes model files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4fc1fb7340
commit
677e2d6624
7 changed files with 360 additions and 38 deletions
|
|
@ -145,6 +145,7 @@
|
|||
"dist/**/*.js",
|
||||
"dist/**/*.d.ts",
|
||||
"dist/**/*.wasm",
|
||||
"assets/models/all-MiniLM-L6-v2/**",
|
||||
"bin/",
|
||||
"brainy.png",
|
||||
"LICENSE",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue