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

Optimize number of comparisons in associative containers assignment and copy #62571

Open
ldionne opened this issue May 5, 2023 · 1 comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. performance

Comments

@ldionne
Copy link
Member

ldionne commented May 5, 2023

When we copy construct or copy-assign a std::map, instead of doing something akin to map.insert(begin, end) (which requires a bunch of comparisons), we could copy the underlying RB tree without having to perform any comparisons, since we know the incoming tree is already structured appropriately.

@ldionne ldionne added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. performance labels May 5, 2023
@ldionne
Copy link
Member Author

ldionne commented May 5, 2023

This is related to https://reviews.llvm.org/D121485#inline-1161875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. performance
Projects
None yet
Development

No branches or pull requests

1 participant