File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed
libcxx/test/benchmarks/algorithms/modifying Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,13 @@ int main(int argc, char** argv) {
3232 std::size_t const size = st.range (0 );
3333 using ValueType = typename Container::value_type;
3434 ValueType x = Generate<ValueType>::random ();
35- ValueType y = Generate<ValueType>::random ();
36- Container c (size, y);
35+ Container c (size, x);
3736
3837 for ([[maybe_unused]] auto _ : st) {
3938 benchmark::DoNotOptimize (c);
4039 benchmark::DoNotOptimize (x);
4140 fill (c.begin (), c.end (), x);
4241 benchmark::DoNotOptimize (c);
43- std::swap (x, y);
4442 }
4543 })
4644 ->Arg (32 )
@@ -61,15 +59,13 @@ int main(int argc, char** argv) {
6159 benchmark::RegisterBenchmark (name, [fill](auto & st) {
6260 std::size_t const size = st.range (0 );
6361 bool x = true ;
64- bool y = false ;
65- std::vector<bool > c (size, y);
62+ std::vector<bool > c (size, x);
6663
6764 for ([[maybe_unused]] auto _ : st) {
6865 benchmark::DoNotOptimize (c);
6966 benchmark::DoNotOptimize (x);
7067 fill (c.begin (), c.end (), x);
7168 benchmark::DoNotOptimize (c);
72- std::swap (x, y);
7369 }
7470 })->Range (64 , 1 << 20 );
7571 };
Original file line number Diff line number Diff line change @@ -32,15 +32,13 @@ int main(int argc, char** argv) {
3232 std::size_t const size = st.range (0 );
3333 using ValueType = typename Container::value_type;
3434 ValueType x = Generate<ValueType>::random ();
35- ValueType y = Generate<ValueType>::random ();
36- Container c (size, y);
35+ Container c (size, x);
3736
3837 for ([[maybe_unused]] auto _ : st) {
3938 benchmark::DoNotOptimize (c);
4039 benchmark::DoNotOptimize (x);
4140 fill_n (c.begin (), size, x);
4241 benchmark::DoNotOptimize (c);
43- std::swap (x, y);
4442 }
4543 })
4644 ->Arg (32 )
@@ -61,15 +59,13 @@ int main(int argc, char** argv) {
6159 benchmark::RegisterBenchmark (name, [fill_n](auto & st) {
6260 std::size_t const size = st.range (0 );
6361 bool x = true ;
64- bool y = false ;
65- std::vector<bool > c (size, y);
62+ std::vector<bool > c (size, x);
6663
6764 for ([[maybe_unused]] auto _ : st) {
6865 benchmark::DoNotOptimize (c);
6966 benchmark::DoNotOptimize (x);
7067 fill_n (c.begin (), size, x);
7168 benchmark::DoNotOptimize (c);
72- std::swap (x, y);
7369 }
7470 })->Range (64 , 1 << 20 );
7571 };
You can’t perform that action at this time.
0 commit comments