tychedelia / kafka-protocol-rs

Rust Kafka protocol
Apache License 2.0
63 stars 23 forks source link

Reduce allocations when decoding maps #94

Closed rukai closed 1 month ago

rukai commented 1 month ago

This PR alters the decode logic for maps to avoid reallocations due to map growth from insertions. By using iterators + collect the size of the allocation required for the IndexMap is known up front, avoiding the need for reallocations as decoded items are inserted to the map.

This should give a small speed up to decoding of produce messages since they use maps.