-
Notifications
You must be signed in to change notification settings - Fork 444
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
Replace boost::container::flat_map with absl::btree_map in P4Tools. #4768
Conversation
013c70f
to
406a52b
Compare
Note that |
We do not remove elements from these maps (although we should...) and I believe we only iterate for debugging. Pointer stability could be a problem but can't currently think of a case where. |
21bf9fa
to
9bfab6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually looks good to me, just some code quality suggestions.
I noticed |
Signed-off-by: fruffy <[email protected]>
Signed-off-by: fruffy <[email protected]>
Signed-off-by: fruffy <[email protected]>
Signed-off-by: fruffy <[email protected]>
Yet another variant of #4667 and #4713 but a bit more conservative.
btree_map
is a memory-efficient variant ofstd::map
which does not require hashing. We can use it to replaceboost::container::flat_map
in P4Tools.Reason why I am splitting this PR out:
#4667 introduces some hash functions which are still too inefficient and needs improvement.
#4713 introduces a new data structure (flat_map) which should be reviewed separately.
The other two PRs will be rebased after this one is in.