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

Keep AcquireBytes consistent #107

Closed
wenxuwan opened this issue Nov 10, 2022 · 1 comment · Fixed by #108
Closed

Keep AcquireBytes consistent #107

wenxuwan opened this issue Nov 10, 2022 · 1 comment · Fixed by #108

Comments

@wenxuwan
Copy link
Contributor

What would you like to be added:

When the current AcquireBytes function misses a byte slice in the pool, it will return a byte slice with a length of 0 and a cap of size, and when it hits, it will return a slice with both length and cap of size. I think consistency is more user friendly

Why is this needed:

When the current AcquireBytes function misses a byte slice in the pool, it will return a byte slice with a length of 0 and a cap of size, and when it hits, it will return a slice with both length and cap of size. I think consistency is more user friendly

@tiltwind
Copy link

@AlexStocks keep consistency is important, but I think should change the size of slice to 0 when hits in pool. Because the user can use it directly without to resize it .

s := AcquireBytes(128)
s = s[:0] // this is wretched
s = append(s , b)

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 a pull request may close this issue.

2 participants