valyala / bytebufferpool

Anti-memory-waste byte buffer pool
MIT License
1.19k stars 132 forks source link

[Question] Why do you use self-made byte buffers? #5

Closed n10v closed 8 years ago

n10v commented 8 years ago

Hi valyala! Thanks for your library. It reduced memory usage of my package by ~10%. But I have one question: why do you wrote your own self-made byte buffers and don't use buffers from standard bytes package? Buffers from bytes package have functions that I need (for example, ReadFrom), but your buffers haven't :(

valyala commented 8 years ago

Both fasthttp and quicktemplate had almost identical ByteBuffer implementations, so I just extracted them into bytebufferpool package :)

fasthttp and quicktemplate don't use bytes.Buffer, because they need only a small subset of the functionality provided by bytes.Buffer. And this functionality should be tuned for performance.

valyala commented 8 years ago

@bogem , now ByteBuffer from bytebufferpool supports ReadFrom.

n10v commented 8 years ago

@valyala Thanks a lot!