@@ -34,7 +34,7 @@ int main(int argc, char** argv) {
34
34
};
35
35
36
36
// Benchmark ranges::{find_last,find_last_if,find_last_if_not} where the last element
37
- // is found 25 % into the sequence
37
+ // is found 10 % into the sequence
38
38
{
39
39
auto bm = []<class Container >(std::string name, auto find_last) {
40
40
benchmark::RegisterBenchmark (
@@ -46,8 +46,8 @@ int main(int argc, char** argv) {
46
46
ValueType y = random_different_from ({x});
47
47
Container c (size, x);
48
48
49
- // put the element we're searching for at 25 % of the sequence
50
- *std::next (c.begin (), size / 4 ) = y;
49
+ // put the element we're searching for at 10 % of the sequence
50
+ *std::next (c.begin (), size / 10 ) = y;
51
51
52
52
for ([[maybe_unused]] auto _ : st) {
53
53
benchmark::DoNotOptimize (c);
@@ -64,26 +64,26 @@ int main(int argc, char** argv) {
64
64
};
65
65
66
66
// find_last
67
- bm.operator ()<std::vector<char >>(" rng::find_last(vector<char>) (bail 25 %)" , std::ranges::find_last);
68
- bm.operator ()<std::vector<int >>(" rng::find_last(vector<int>) (bail 25 %)" , std::ranges::find_last);
69
- bm.operator ()<std::deque<int >>(" rng::find_last(deque<int>) (bail 25 %)" , std::ranges::find_last);
70
- bm.operator ()<std::list<int >>(" rng::find_last(list<int>) (bail 25 %)" , std::ranges::find_last);
71
- bm.operator ()<std::forward_list<int >>(" rng::find_last(forward_list<int>) (bail 25 %)" , std::ranges::find_last);
67
+ bm.operator ()<std::vector<char >>(" rng::find_last(vector<char>) (bail 10 %)" , std::ranges::find_last);
68
+ bm.operator ()<std::vector<int >>(" rng::find_last(vector<int>) (bail 10 %)" , std::ranges::find_last);
69
+ bm.operator ()<std::deque<int >>(" rng::find_last(deque<int>) (bail 10 %)" , std::ranges::find_last);
70
+ bm.operator ()<std::list<int >>(" rng::find_last(list<int>) (bail 10 %)" , std::ranges::find_last);
71
+ bm.operator ()<std::forward_list<int >>(" rng::find_last(forward_list<int>) (bail 10 %)" , std::ranges::find_last);
72
72
73
73
// find_last_if
74
- bm.operator ()<std::vector<char >>(" rng::find_last_if(vector<char>) (bail 25 %)" , ranges_find_last_if);
75
- bm.operator ()<std::vector<int >>(" rng::find_last_if(vector<int>) (bail 25 %)" , ranges_find_last_if);
76
- bm.operator ()<std::deque<int >>(" rng::find_last_if(deque<int>) (bail 25 %)" , ranges_find_last_if);
77
- bm.operator ()<std::list<int >>(" rng::find_last_if(list<int>) (bail 25 %)" , ranges_find_last_if);
78
- bm.operator ()<std::forward_list<int >>(" rng::find_last_if(forward_list<int>) (bail 25 %)" , ranges_find_last_if);
74
+ bm.operator ()<std::vector<char >>(" rng::find_last_if(vector<char>) (bail 10 %)" , ranges_find_last_if);
75
+ bm.operator ()<std::vector<int >>(" rng::find_last_if(vector<int>) (bail 10 %)" , ranges_find_last_if);
76
+ bm.operator ()<std::deque<int >>(" rng::find_last_if(deque<int>) (bail 10 %)" , ranges_find_last_if);
77
+ bm.operator ()<std::list<int >>(" rng::find_last_if(list<int>) (bail 10 %)" , ranges_find_last_if);
78
+ bm.operator ()<std::forward_list<int >>(" rng::find_last_if(forward_list<int>) (bail 10 %)" , ranges_find_last_if);
79
79
80
80
// find_last_if_not
81
- bm.operator ()<std::vector<char >>(" rng::find_last_if_not(vector<char>) (bail 25 %)" , ranges_find_last_if_not);
82
- bm.operator ()<std::vector<int >>(" rng::find_last_if_not(vector<int>) (bail 25 %)" , ranges_find_last_if_not);
83
- bm.operator ()<std::deque<int >>(" rng::find_last_if_not(deque<int>) (bail 25 %)" , ranges_find_last_if_not);
84
- bm.operator ()<std::list<int >>(" rng::find_last_if_not(list<int>) (bail 25 %)" , ranges_find_last_if_not);
81
+ bm.operator ()<std::vector<char >>(" rng::find_last_if_not(vector<char>) (bail 10 %)" , ranges_find_last_if_not);
82
+ bm.operator ()<std::vector<int >>(" rng::find_last_if_not(vector<int>) (bail 10 %)" , ranges_find_last_if_not);
83
+ bm.operator ()<std::deque<int >>(" rng::find_last_if_not(deque<int>) (bail 10 %)" , ranges_find_last_if_not);
84
+ bm.operator ()<std::list<int >>(" rng::find_last_if_not(list<int>) (bail 10 %)" , ranges_find_last_if_not);
85
85
bm.operator ()<std::forward_list<int >>(
86
- " rng::find_last_if_not(forward_list<int>) (bail 25 %)" , ranges_find_last_if_not);
86
+ " rng::find_last_if_not(forward_list<int>) (bail 10 %)" , ranges_find_last_if_not);
87
87
}
88
88
89
89
// Benchmark ranges::{find_last,find_last_if,find_last_if_not} where the last element
@@ -100,7 +100,7 @@ int main(int argc, char** argv) {
100
100
Container c (size, x);
101
101
102
102
// put the element we're searching for at 90% of the sequence
103
- *std::next (c.begin (), 9 * ( size / 10 ) ) = y;
103
+ *std::next (c.begin (), ( 9 * size) / 10 ) = y;
104
104
105
105
for ([[maybe_unused]] auto _ : st) {
106
106
benchmark::DoNotOptimize (c);
0 commit comments