Skip to content

perf(messagestream): optimize parsing performance with lazy getter (Issue #933)#936

Open
Emeenent14 wants to merge 1 commit intoanthropics:mainfrom
Emeenent14:perf/messagestream-lazy-parsing
Open

perf(messagestream): optimize parsing performance with lazy getter (Issue #933)#936
Emeenent14 wants to merge 1 commit intoanthropics:mainfrom
Emeenent14:perf/messagestream-lazy-parsing

Conversation

@Emeenent14
Copy link
Copy Markdown

Converted content.input in MessageStream to a lazy getter. Previously, the SDK re-parsed the entire JSON buffer on every delta, leading to O(N²) complexity. This change ensures parsing only happens when needed, drastically improving responsiveness for large streaming responses.

Closes #933

@Emeenent14 Emeenent14 requested a review from a team as a code owner March 8, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

O(N²) performance bottleneck in [MessageStream](src/lib/MessageStream.ts#51-747) during structured output streaming

1 participant