Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance for large messages across many chunks #130

Merged
merged 1 commit into from Jan 27, 2020

Conversation

trentmwillis
Copy link
Contributor

@trentmwillis trentmwillis commented Oct 9, 2019

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
Contributor

@aslakhellesoy aslakhellesoy left a comment

Thanks a lot for this @trentmwillis!

test/eventsource_test.js Show resolved Hide resolved
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.

None yet

3 participants