Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pack: enhance memory allocation strategy for large JSON payloads
When converting msgpack buffers with large JSON text content, the buffering strategy is not quite optimal since the outgoing buffer always set an output buffer of size 1.5x, then if more space is needed the code reallocate by adding 256 bytes more. If the large payload needs more than 1.5x, the 256 bytes allocation generates a slow path and may lead to hundreds of memory reallocations, adding latency to the pipeline. This patch improves the strategy by allocating an initial buffer size of 2x and then if more space is needed, increase in rounds of 10% of the original payload size. Signed-off-by: Eduardo Silva <[email protected]>
- Loading branch information