-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
Description
Description
During streaming responses, OpenCode writes to storage (JSON files) on every reasoning-delta event. With fast streaming APIs, this results in hundreds of file writes per second.
Impact
- High I/O overhead from frequent file system operations
- Increased latency between receiving content and displaying it
- Slower perceived response time compared to native CLI tools (e.g., kiro-cli)
Root Cause
In processor.ts, every delta triggers a storage write:
case "reasoning-delta":
if (part.text) await Session.updatePart({ part, delta: value.text })Session.updatePart calls Storage.write which writes to the file system on every call.
Proposed Solution
Throttle storage writes during streaming:
- Accumulate content in memory
- Only flush to storage every 50ms
- Always flush on
reasoning-end
Environment
- OpenCode version: latest
- Tested with Kiro API streaming responses
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization