I’m trying to understand why CompositeByteBuf, consolidates if the number of components in the compositebytebuf becomes more than ‘maxNumComponents’ while adding component?
This consolidation involves copy operations. My questions are -
- why CompositeByteBuf is doing this consolidation automatically if the number of components is greater than ‘maxNumComponents’? what is the advantage in doing so?
- Will there be any disadvantage if we explicitly set ‘maxNumComponents’ to very high number, so that consolidation will not be triggered.
It does this because once you have a lot of buffers in a
CompositeByteBuf
accessing things on a specific index can for example become very slow.If this is a problem for you or not depends highly on the use-case.