Skip to content

Improve performance of eventsource parser #5862

@gr2m

Description

@gr2m

Description

This is a follow up to #5325 (comment).

I created a simple benchmark that compares @rexxars eventsource-parser and @ai-sdk/provider-utils' own implementation based on the bug report by @wong2:

https://github.com/gr2m/eventsource-parser-benchmark/#readme

Based on this particular use case, eventsource-parser-3.0.1 is

  1. ~100x faster than eventsource-parser-3.0.0, and
  2. ~10x faster than @ai-sdk/provider-utils' own implementation

I couldn't yet figure out where the performance difference between eventsource-parser-3.0.1 and @ai-sdk/provider-utils' own implementation is coming from. I'll look more into it this coming week

Metadata

Metadata

Assignees

Labels

ai/corecore functions like generateText, streamText, etc. Provider utils, and provider spec.ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelfeatureNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions