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

Investigate potential optimization for key extraction #99

Closed
Tracked by #35
tillrohrmann opened this issue Feb 17, 2023 · 1 comment
Closed
Tracked by #35

Investigate potential optimization for key extraction #99

tillrohrmann opened this issue Feb 17, 2023 · 1 comment
Labels
performance Performance tasks
Milestone

Comments

@tillrohrmann
Copy link
Contributor

tillrohrmann commented Feb 17, 2023

With #87 we import the key extraction based on the PoC. This implementation requires a couple of allocations for extracting a key from a grpc message (allocating growing target buffer and HashMaps for parsing the individual parts of a key). Since the key extraction is on the hot path this might be a problem.

First, we should measure the impact of these allocations. If this is noticeable, we might explore some potential optimizations:

  1. Using a SegmentedBuf instead of a BytesMut for collecting the parts of the final key. This should help avoiding to allocate a growing byte buffer.
  2. Add another pass over the grpc message to collect meta information about the key. This information includes its total length and where each field is located. That way, we could pre-allocate a correctly sized BytesMut and don't have to reorder the fields since we would know exactly where to put them in the final BytesMut.
@slinkydeveloper
Copy link
Contributor

Irrelevant now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance tasks
Projects
None yet
Development

No branches or pull requests

2 participants