-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Make copying optional when receiving data #428
Make copying optional when receiving data #428
Conversation
Absolutely, here is the spot where we mutate the There is an interesting thing here - it looks like we are safe at not doing any copying for the data, unless it's a control frame, because then we are going to continue adding more data to the current frame data. |
Is it really as simple as the small change in 6ba8526? |
Yes, this is what it looks like. Would love to hear if this solution actually works on a big scale and doesn't cause any problems. |
Please rebase and let's test it heavily together. |
Thanks for your help with this. We've updated our app to use this new branch. We'll test in dev and QA for some period of time, and if all goes well there, the changes will end up in our next App Store release. If you leave this PR open, I will follow up here in about a month or so, assuming we don't run into problems before then. |
Also, I assumed this project prefers merge instead of rebase (I merged before I noticed your response), but if you want me to rebase the branch against |
The way we do it is weird :) As much as possible I rebase the branches, so everything stays in sync and is well-tested on the latest master.
Sounds perfect! I am also going to try doing some stress testing on this, so we attack this from both ends. If you encounter any issues - please follow-up here. Going to remove |
Reduce memory usage by discarding, not resetting, the frame data buffer. Let delegate control copying.
This reverts commit 4d5f5f0.
d27722c
to
e95367b
Compare
Permalink, for posterity (mainly for my own reference). |
Just wanted to update this issue: it's been a little over a month, and these changes have gone through our QA and been shipped in two App Store releases. So far, we haven't seen any reason to suspect that they cause problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is good to go!
Amazing performance and memory consumption improvement!
Thank you for bearing with me through the process!
* Reduce memory usage Reduce memory usage by discarding, not resetting, the frame data buffer. Let delegate control copying. * Delegate methods expect `self` * Add `-sendWithoutCopyingData:error:` * Add `-webSocket:shouldCopyReceivedData:` * Fix error messages * Remove `-webSocket:shouldCopyReceivedData:` * Revert "Fix error messages" This reverts commit 4d5f5f0. * Fix typo * Copy only control frames * Fix error message
* Reduce memory usage Reduce memory usage by discarding, not resetting, the frame data buffer. Let delegate control copying. * Delegate methods expect `self` * Add `-sendWithoutCopyingData:error:` * Add `-webSocket:shouldCopyReceivedData:` * Fix error messages * Remove `-webSocket:shouldCopyReceivedData:` * Revert "Fix error messages" This reverts commit 4d5f5f0. * Fix typo * Copy only control frames * Fix error message
For context, see #424, #426, and #427.
Starting the conversation again on making copying of received frame data optional.
Can you elaborate a bit on where the mutation occurs? I scanned the code, and although the data is passed to numerous delegate methods (any one of which could mutate the data), I don't see where the library itself does so. But I'm probably just not seeing it.