@@ -41,10 +41,16 @@ struct BenchmarkConfig {
41
41
touch_file : Option < String > ,
42
42
43
43
category : Category ,
44
+
44
45
/// Profiles that are not useful for this benchmark.
45
46
/// They will be ignored during benchmarking.
46
47
#[ serde( default ) ]
47
48
excluded_profiles : HashSet < Profile > ,
49
+
50
+ /// Scenarios that are not useful for this benchmark.
51
+ /// They will be ignored during benchmarking.
52
+ #[ serde( default ) ]
53
+ excluded_scenarios : HashSet < Scenario > ,
48
54
}
49
55
50
56
#[ derive( Ord , PartialOrd , Eq , PartialEq , Clone , Hash ) ]
@@ -185,6 +191,11 @@ impl Benchmark {
185
191
compiler : Compiler < ' _ > ,
186
192
iterations : Option < usize > ,
187
193
) -> anyhow:: Result < ( ) > {
194
+ if self . config . disabled {
195
+ eprintln ! ( "Skipping {}: disabled" , self . name) ;
196
+ bail ! ( "disabled benchmark" ) ;
197
+ }
198
+
188
199
let iterations = iterations. unwrap_or ( self . config . runs ) ;
189
200
190
201
let profiles: Vec < Profile > = profiles
@@ -193,16 +204,22 @@ impl Benchmark {
193
204
. filter ( |profile| !self . config . excluded_profiles . contains ( profile) )
194
205
. collect ( ) ;
195
206
196
- if self . config . disabled {
197
- eprintln ! ( "Skipping {}: disabled" , self . name) ;
198
- bail ! ( "disabled benchmark" ) ;
199
- }
200
-
201
207
if profiles. is_empty ( ) {
202
208
eprintln ! ( "Skipping {}: no profiles selected" , self . name) ;
203
209
return Ok ( ( ) ) ;
204
210
}
205
211
212
+ let scenarios: Vec < Scenario > = scenarios
213
+ . into_iter ( )
214
+ . copied ( )
215
+ . filter ( |scenario| !self . config . excluded_scenarios . contains ( scenario) )
216
+ . collect ( ) ;
217
+
218
+ if scenarios. is_empty ( ) {
219
+ eprintln ! ( "Skipping {}: no scenarios selected" , self . name) ;
220
+ return Ok ( ( ) ) ;
221
+ }
222
+
206
223
eprintln ! ( "Preparing {}" , self . name) ;
207
224
let profile_dirs = profiles
208
225
. iter ( )
0 commit comments