[libcxx-commits] [libcxx] [libc++] Optimize rotate (PR #120890)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 12 00:02:43 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- libcxx/test/benchmarks/algorithms/rotate.bench.cpp libcxx/include/__algorithm/rotate.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/benchmarks/algorithms/rotate.bench.cpp b/libcxx/test/benchmarks/algorithms/rotate.bench.cpp
index 36ec1021b..4ab4a6ec2 100644
--- a/libcxx/test/benchmarks/algorithms/rotate.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/rotate.bench.cpp
@@ -16,15 +16,13 @@
#include <benchmark/benchmark.h>
-void run_sizes(auto benchmark) {
- benchmark->Arg(1)->Arg(4)->Arg(32)->Arg(64)->Arg(512)->Arg(4096)->Arg(65536);
-}
+void run_sizes(auto benchmark) { benchmark->Arg(1)->Arg(4)->Arg(32)->Arg(64)->Arg(512)->Arg(4096)->Arg(65536); }
template <class Container>
static void BM_std_rotate(benchmark::State& state) {
Container c(state.range(), typename Container::value_type());
const auto relative_offset = state.range();
- auto middle = std::next(c.begin(), c.size() / relative_offset);
+ auto middle = std::next(c.begin(), c.size() / relative_offset);
for (auto _ : state) {
benchmark::DoNotOptimize(c);
``````````
</details>
https://github.com/llvm/llvm-project/pull/120890
More information about the libcxx-commits
mailing list