perf: speed up startup from ~15s to ~2s (#280)

Three high-impact changes eliminate most startup latency:

1. Enable wasmtime persistent compilation cache — call
   cache_config_load_default() so compiled native code is serialized to
   disk (~/.cache/wasmtime). Subsequent startups deserialize instead of
   recompiling, dropping the WASM phase from ~13s to <1s.

2. Cache compiled Component in PreparedModule — store the compiled
   wasmtime::component::Component directly instead of raw bytes.
   Eliminates ~2.6s recompilation on every first tool/channel execution.

3. Move blocking housekeeping to background tasks — embedding backfill
   (~1.3s of failing HTTP calls) and stale job cleanup are fire-and-forget
   work that no longer blocks the critical startup path.

Also: deduplicate Workspace creation in main.rs (two identical instances
reduced to one), and replace leftover println! in session validation with
tracing calls.

Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Illia Polosukhin
2026-02-21 02:30:57 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 2cdd1acb1e
commit 98ee648fcb
8 changed files with 130 additions and 81 deletions
+3 -3
View File
@@ -157,14 +157,14 @@ impl SessionManager {
}
// Token exists, validate it by calling /v1/users/me
println!("Validating session...");
tracing::debug!("Validating session...");
match self.validate_token().await {
Ok(()) => {
println!("Session valid.");
tracing::debug!("Session valid");
Ok(())
}
Err(e) => {
println!("Session expired or invalid: {}", e);
tracing::info!("Session expired or invalid: {}", e);
self.initiate_login().await
}
}