[libcxx-commits] [libcxx] [libc++] Speed up vector<bool> copy/move-ctors [1/3] (PR #120132)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 13 11:57:10 PDT 2025


https://github.com/ldionne requested changes to this pull request.

@philnik777 If this patch uses `std::copy(__v.begin(), __v.end(), begin())`, we need to handle the leading bits in the last word like `__construct_at_end` does:

```c++
if (end().__ctz_ != 0)
  std::fill_n(end(), __bits_per_word - end().__ctz_, 0);
```

Then, the benefit of this patch basically goes away since we'd be better off just calling `__construct_at_end` and not inlining anything.

That being said, since we are failing to gain consensus to move forward with this patch, I would suggest that we take the test improvements in this patch and land them, and not move forward with the refactoring part of the patch. After the recent improvements to `std::vector<bool>` optimizations, the refactoring part of this patch doesn't provide as much value, and I think our time may be better spent on something else than trying to gain consensus on a minor stylistic refactoring.

https://github.com/llvm/llvm-project/pull/120132


More information about the libcxx-commits mailing list