Advanced
Performance Optimization for Large-Scale Plugins
Performance Optimization for Large-Scale Plugins — Learn how to build advanced dsh plugins.
Hot path optimization
Tools are called by the model in tight loops. Slow tools block the entire conversation.
// Bad: synchronous file read in tool
const content = fs.readFileSync(path, 'utf8');
// Good: async with timeout
const content = await withTimeout(fs.readFile(path, 'utf8'), 5000);Caching strategies
Cache expensive computations. Use in-memory LRU for hot paths, persist to disk for cold data.