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

Utilise byteSlice as a part of struct to avoid allocations #686

Merged
merged 1 commit into from
Mar 25, 2022
Merged

Utilise byteSlice as a part of struct to avoid allocations #686

merged 1 commit into from
Mar 25, 2022

Conversation

moredure
Copy link
Contributor

@moredure moredure commented Mar 17, 2022

@lance6716
Copy link
Collaborator

Hi, can you explain what's the benefit of this change? I'm not sure what you want to improve, maybe *[]byte is better than *struct{ []byte }

@moredure
Copy link
Contributor Author

moredure commented Mar 21, 2022

from code quality perspective struct is more simple, *[]byte needed to be dereferenced first, but original link to the slice pointer should be returned back to the pool

@lance6716
Copy link
Collaborator

from code quality perspective struct is more simple, *[]byte needed to be dereferenced first, but original link to the slice pointer should be returned back to the pool

Yes, I just can't understand which part contributes to the title "Utilise byteSlice as a part of struct to avoid allocations". In this PR I guess you want to avoid allocating the slice header for []byte? And remove the 10-length channel just keep same style as #682 ?

@moredure
Copy link
Contributor Author

Exactly, slice header + channel of size 10.

Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

wait some days for @atercattus online

@atercattus
Copy link
Member

lgtm too. Thank you for waiting for me :)

@lance6716 lance6716 merged commit 73ce4d0 into go-mysql-org:master Mar 25, 2022
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