Conversation
Signed-off-by: Matt Klein <mklein@lyft.com>
htuch
previously approved these changes
Dec 31, 2017
| // buffer on the heap and use it for all calculations. The needed size is the size of the | ||
| // address, plus '_', plus 32 bytes for the index. All of this is done to avoid string | ||
| // allocations in the fast path. | ||
| const uint64_t needed_size = std::min(128UL, address_string.size() + 1 + 32); |
Member
There was a problem hiding this comment.
Is there some constant we can use for max 64-bit representation? In the StringUtil::itoa comment it says this is 21 (including null), here we use 32 just to be safe (I think).
Member
Author
There was a problem hiding this comment.
Yeah I will add a constant. I realized this code has a bug, it should be std::max, not min. I'm going to redo it also to use https://github.com/abseil/abseil-cpp/blob/master/absl/container/inlined_vector.h which would make it stack allocated in most case and easier to read. Will also add a test that would catch the min/max issue. I will update all of it tomorrow.
Member
Author
|
@htuch updated. I decided to take a simpler approach. Update comments also. |
htuch
approved these changes
Jan 1, 2018
jpsim
added a commit
that referenced
this pull request
Nov 28, 2022
Follow-up to envoyproxy/envoy-mobile#2277. Signed-off-by: JP Simard <jp@jpsim.com>
jpsim
added a commit
that referenced
this pull request
Nov 29, 2022
Follow-up to envoyproxy/envoy-mobile#2277. Signed-off-by: JP Simard <jp@jpsim.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoid string copies during the inner loop of the ring build.
Risk Level: Low
Testing: Existing unit tests
Docs Changes: N/A
Release Notes: N/A