-
Notifications
You must be signed in to change notification settings - Fork 338
Fixing a performance issue in SSE client #221
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
Conversation
Doesn't work for me at all on Mac OS X -- I simply don't receive any listen events. This definitely needs to be tested with a real HTTP stream. Also note that while this should hopefully improve the constant factor, it's still O(N^2). |
There seems to be a The proposed solution essentially reduces N by reading data in chunks. With the fix I've tested payloads (in the unit tests) as large as 10MB, which can be processed under a second. |
Attached is another solution I've been tinkering with. It doesn't change how we read content from
With this I was able to read a 1MB node from a production database in under 10 seconds. Feedback welcome. |
I like that solution better since it is indeed linear time. Of course for maximum performance we'd need to figure out how to read in bigger chunks and not process each character individually in Python, but I'm happy with the improvement. |
@daniel-ziegler I've cleaned up the 2nd solution and committed it. Can you give it a try? My performance numbers are added to the PR description. |
Seems to work; obviously I haven't tested it very thoroughly. |
Improves the streaming RTDB API performance by checking for end of field more efficiently. Specifically, instead of matching a regex on each iteration, we keep track of the last 4 characters seen, and perform a simple string comparison.
Here are some preliminary test results to get an idea of the improvement.
Fixes #198