Skip to content

Improve performance for large messages across many chunks#130

Merged
rexxars merged 1 commit intoEventSource:masterfrom
trentmwillis:large-message-perf
Jan 27, 2020
Merged

Improve performance for large messages across many chunks#130
rexxars merged 1 commit intoEventSource:masterfrom
trentmwillis:large-message-perf

Conversation

@trentmwillis
Copy link
Copy Markdown
Contributor

Recently ran into an issue with large payloads (megabytes in size) that arrived over many chunks. As the size increased, the time to process them seemed to increase exponentially. After investigating a bit, realized that each time a new chunk arrives, any data in the buffer from before gets re-parsed. Thus, for very large messages you might wind up re-parsing the early data many times.

This change adds a couple variables to track data that has already been processed to skip evaluating it multiple times.

Copy link
Copy Markdown
Contributor

@aslakhellesoy aslakhellesoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @trentmwillis!

Comment thread test/eventsource_test.js
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.

3 participants