V Vant Docs

Efficiency

Vant’s state IS your files, so most efficiency work is about not doing needless work: budgeting calls, caching, batching, and compressing what lives in the brain. Every lever below is verified against the code.

Rate budgets

Cache, don’t refetch

lib/cache.js is the process-local cache with TTL semantics, and lib/tmp.js fronts it for scratch values:

tmp.cacheSet('session', data, 3600000);  // 1 hour TTL
const val = tmp.cacheGet('session');     // null when expired

There is no automatic HTTP conditional-get layer in the connectors today: if a GitHub call is hot in your loop, cache its result yourself with the helper above rather than waiting on the rate budget.

Batch the embedding work

lib/embed.js batches vectorization instead of one call per item, and stack-wide reindexing is a single call:

const embed = require('vant/lib/embed');

await embed.generateBatch([textA, textB, textC]);  // one batch, embed:batch events
await embed.generateBatchStack(texts);            // batch across the whole brain stack

Compress what you keep

Trim the context, not the data

Startup: what actually happens

vant start runs migrate, then health, then ready - and by design it does NOT sync automatically (pass 121 ruling):

So the cheapest startup is already the default: vant start and skip both migration and sync explicitly only when you know why.