-
Notifications
You must be signed in to change notification settings - Fork 380
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
data packet unmarshal binary: remove uneeded copy #338
Conversation
some interesting numbers here: this patch give a 20% performance improvement for the user who posted the results. In my tests, on my laptop, the improvement is smaller |
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 good. The []byte
is made in `recvPacket' and then unused except for this copy.
@puellanivis Thanks! I wonder if we can improve this code too:
I need to find some time to benchmark the different ways to prepend For what I can undestand reading pkg/sftp code there are no other obvious optimizations |
prepending is known to be an expensive operation, which is why Go does not have a builtin primitive for it, that would parallel Although, looking at it, it might be better to just allocate the 4 bytes at the head right from the start, and just skip over them. Then later we can inject the length into it. |
the latest patch, applied on the top of my allocator branch, makes pkg/sftp upload performance very similar to my scp implementation. I don't know why statvfs test fails on MacOS, it use |
Travis has made it impossible to trigger re-tests so I'll pull this down and check locally. The integration tests can be a bit overly fragile. [edit] Wait... I dont' have a Mac, so I can't check it locally. :P Guess I'll push up a test branch to trigger Travis. Seriously thinking about switching to CircleCI. |
I triggered 2 travis runs and they both came back fine. So just going to ignore the failure and merge this. |
@drakkan Thanks for the PR! |
No description provided.