[libcxx-commits] [libcxx] [libc++] Speed up vector<bool> copy/move-ctors [1/3] (PR #120132)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 20 07:06:39 PST 2025
winner245 wrote:
> We should instead fix #64038.
We should prioritize fixing the bitwise algorithms in #64038. I have already submitted PRs to address this, but I believe the approach in this PR presents several advantages:
1. **Simplicity and Maintainability**: This approach directly calls the plain-form `std::copy`, which copies entire words instead of manipulating individual bits. This leads to simpler and more maintainable code. Bitwise algorithms can be complex and tricky to implement, potentially increasing the maintenance burden in the future.
2. **Reliability**: The method in this PR is inherently less error-prone, as the plain-form `std::copy` is a widely used and thoroughly tested algorithm. In contrast, bitwise overloads of `std::copy` can be challenging to implement and prone to errors. We've encountered undefined behavior issues with these algorithms, as highlighted in #122410 and #122528. Furthermore, our current test coverage for the bitwise algorithms is very limited, primarily focusing only on 1-2 bytes. I have submitted PRs (#121209, #121138, #120909) to enhance the test coverage for these algorithms.
Given the above concerns, I believe that proceeding with this PR remains a valuable choice.
https://github.com/llvm/llvm-project/pull/120132
More information about the libcxx-commits
mailing list