ai icon indicating copy to clipboard operation
ai copied to clipboard

Improve performance of eventsource parser

Open gr2m opened this issue 7 months ago • 0 comments

Description

This is a follow up to https://github.com/vercel/ai/issues/5325#issuecomment-2756747066.

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

gr2m avatar Apr 21 '25 04:04 gr2m