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

Неверный расчёт defaultSize и maxSize #15

Open
MichaelMonashev opened this issue Nov 5, 2017 · 1 comment
Open

Неверный расчёт defaultSize и maxSize #15

MichaelMonashev opened this issue Nov 5, 2017 · 1 comment

Comments

@MichaelMonashev
Copy link

Если в строке https://github.com/valyala/bytebufferpool/blob/master/pool.go#L113 сделать вывод результатов калибровки, то окажется, что defaultSize и maxSize очень маленькие. У меня было всего 128 байт почему-то. Хотя данные с которыми работает в основном пул лежат в интервале 1-2кб. Из-за этого естественно append-ы генерят кучу аллокаций сводя на нет все преимущества bytebufferpool .

@yonderblue
Copy link

yonderblue commented Apr 26, 2023

Google translate:

Incorrect calculation of defaultSize and maxSize

If you output the calibration results in the line https://github.com/valyala/bytebufferpool/blob/master/pool.go#L113 , then it turns out that defaultSize and maxSize are very small. I only had 128 bytes for some reason. Although the data with which the pool mainly works lies in the range of 1-2kb. Because of this, appends naturally generate a bunch of allocations, negating all the benefits of bytebufferpool .

I have this problem as well for larger byte slices.

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

No branches or pull requests

2 participants