encode compute_size method is very slow.
rukai opened this issue · 1 comments
rukai commented
In my usage of kafka-protocol I just directly use Encodable::encode without first reserving any bytes in the BytesMut
.
Given that there is an Encodable::compute_size method I figured it must be faster to first use that first and then reserve the needed space.
However doing that resulted in my benchmarks regressing!
I guess the compute_size method is just more expensive than avoiding reallocating.
I'll do a further investigation myself, as I really would like compute_size to improve performance, currently this issue is mostly a headsup to others that the problem exists.
rukai commented
I fixed a bug in my code and now I'm seeing neutral results or possibly a slight increase in performance 😅
Sorry for the noise!