2121// Run with:
2222// cargo bench --bench iseriser_bench
2323
24- use criterion:: { black_box , criterion_group, criterion_main, Criterion } ;
24+ use criterion:: { Criterion , criterion_group, criterion_main} ;
2525use iseriser:: manifest:: { parse_manifest, validate} ;
26+ use std:: hint:: black_box;
2627
2728// ---------------------------------------------------------------------------
2829// Manifest TOML fixtures
@@ -100,8 +101,8 @@ description = "Gleam interop -iser targeting the BEAM runtime"
100101fn bench_parse_minimal ( c : & mut Criterion ) {
101102 c. bench_function ( "parse_manifest/minimal" , |b| {
102103 b. iter ( || {
103- let m = parse_manifest ( black_box ( MINIMAL_MANIFEST ) )
104- . expect ( "minimal manifest must parse" ) ;
104+ let m =
105+ parse_manifest ( black_box ( MINIMAL_MANIFEST ) ) . expect ( "minimal manifest must parse" ) ;
105106 black_box ( m) ;
106107 } ) ;
107108 } ) ;
@@ -111,8 +112,7 @@ fn bench_parse_minimal(c: &mut Criterion) {
111112fn bench_parse_rich ( c : & mut Criterion ) {
112113 c. bench_function ( "parse_manifest/rich_20_primitives" , |b| {
113114 b. iter ( || {
114- let m = parse_manifest ( black_box ( RICH_MANIFEST ) )
115- . expect ( "rich manifest must parse" ) ;
115+ let m = parse_manifest ( black_box ( RICH_MANIFEST ) ) . expect ( "rich manifest must parse" ) ;
116116 black_box ( m) ;
117117 } ) ;
118118 } ) ;
@@ -122,8 +122,7 @@ fn bench_parse_rich(c: &mut Criterion) {
122122fn bench_parse_gleam ( c : & mut Criterion ) {
123123 c. bench_function ( "parse_manifest/gleam_beam_target" , |b| {
124124 b. iter ( || {
125- let m = parse_manifest ( black_box ( GLEAM_MANIFEST ) )
126- . expect ( "gleam manifest must parse" ) ;
125+ let m = parse_manifest ( black_box ( GLEAM_MANIFEST ) ) . expect ( "gleam manifest must parse" ) ;
127126 black_box ( m) ;
128127 } ) ;
129128 } ) ;
@@ -139,7 +138,8 @@ fn bench_validate_valid(c: &mut Criterion) {
139138 c. bench_function ( "validate/valid_manifest" , |b| {
140139 b. iter ( || {
141140 let result = validate ( black_box ( & manifest) ) ;
142- black_box ( result. expect ( "valid manifest must pass validation" ) ) ;
141+ result. expect ( "valid manifest must pass validation" ) ;
142+ black_box ( ( ) ) ;
143143 } ) ;
144144 } ) ;
145145}
@@ -150,7 +150,8 @@ fn bench_validate_rich(c: &mut Criterion) {
150150 c. bench_function ( "validate/rich_20_primitives" , |b| {
151151 b. iter ( || {
152152 let result = validate ( black_box ( & manifest) ) ;
153- black_box ( result. expect ( "rich manifest must pass validation" ) ) ;
153+ result. expect ( "rich manifest must pass validation" ) ;
154+ black_box ( ( ) ) ;
154155 } ) ;
155156 } ) ;
156157}
@@ -200,8 +201,7 @@ fn bench_scan_repo(c: &mut Criterion) {
200201
201202 c. bench_function ( "scan_repo/iseriser_root" , |b| {
202203 b. iter ( || {
203- let recs = iseriser:: scan:: scan_repo ( black_box ( & repo_root) )
204- . expect ( "scan must succeed" ) ;
204+ let recs = iseriser:: scan:: scan_repo ( black_box ( & repo_root) ) . expect ( "scan must succeed" ) ;
205205 black_box ( recs) ;
206206 } ) ;
207207 } ) ;
@@ -218,11 +218,7 @@ criterion_group!(
218218 bench_parse_gleam,
219219) ;
220220
221- criterion_group ! (
222- validate_benches,
223- bench_validate_valid,
224- bench_validate_rich,
225- ) ;
221+ criterion_group ! ( validate_benches, bench_validate_valid, bench_validate_rich, ) ;
226222
227223criterion_group ! (
228224 abi_benches,
0 commit comments