[libcxx-commits] [libcxx] [libc++] Speed-up vector<bool> range-based operations [3/3] (PR #120134)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Dec 21 11:32:59 PST 2024
winner245 wrote:
Thank you for your suggestion.
> Since you're optimizing an algorithm (and nothing specific to `vector<bool>` itself) we should just benchmark that instead. That's significantly less convoluted.
My original motivation for this series of work was to improve the performance of `vector<bool>`. However, I understand your point, and I can focus on optimizing the `std::copy` and `std::move` algorithms instead, and benchmark the performance for the algorithms themselves.
> I'd also like to see some additional tests, especially with iterators that don't return a bool. I'm pretty sure your current implementation is completely broken with that.
Since we are dealing with `__bit_iterator`, my current implementation only works for the bool return type. I plan to add template type constraints to `_InIter` to ensure it returns types that are either bool or convertible to bool. Do you think this approach meets your expectations?
> Lastly, I think we should move this into `__copy_impl`, since we might be able to unwrap iterators to `__bit_iterator`s. I don't think we do that currently, but I see no reason we couldn't in the future. It would also be nice to improve std::move in the same way (and hopefully share the code).
I agree with you and this was also what I planned to do next.
https://github.com/llvm/llvm-project/pull/120134
More information about the libcxx-commits
mailing list