Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kafka-protocol crate #1759

Merged
merged 3 commits into from
Oct 17, 2024
Merged

Update kafka-protocol crate #1759

merged 3 commits into from
Oct 17, 2024

Conversation

rukai
Copy link
Member

@rukai rukai commented Sep 30, 2024

Update to the recently released kafka-protocol 0.13.0

The largest change was tychedelia/kafka-protocol-rs#90 which converted all IndexMap fields to use Vec instead.
This change was required due to the protocol actually supporting duplicate keys at the protocol level. (Its up to the broker to reject responses that are invalid due to duplicate keys)
The easiest way to fix this is to change those fields to Vecs and store the key in the struct.
This approach also comes with some performance benefits at the decode stage as can be seen by the improvement to the decode_request_produce_create benchmark.

Due to the replacement of IndexMap with Vec there was only 1 lookup that would have to be turned into an O(N) lookup.
To avoid it becoming an O(N) lookup I've added an intermediate hashmap which is converted to a vec at the end.
I'm not entirely sure its needed but its the safer option (better worst case) so I took it.

Copy link

codspeed-hq bot commented Sep 30, 2024

CodSpeed Performance Report

Merging #1759 will improve performances by 23.85%

Comparing rukai:update_kafka (de69f81) with main (c64499e)

Summary

⚡ 1 improvements
✅ 37 untouched benchmarks

Benchmarks breakdown

Benchmark main rukai:update_kafka Change
decode_request_produce_create 14.3 µs 11.6 µs +23.85%

@rukai rukai force-pushed the update_kafka branch 7 times, most recently from a7e21b6 to 17ec2f9 Compare October 15, 2024 03:48
@rukai rukai marked this pull request as ready for review October 15, 2024 04:55
@rukai rukai enabled auto-merge (squash) October 17, 2024 07:24
@rukai rukai merged commit 0e8e6ac into shotover:main Oct 17, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants