@@ -47,7 +47,9 @@ const BENCH_ARGS: &[(usize, usize, u8)] = &[
4747fn compress_fsst ( bencher : Bencher , ( string_count, avg_len, unique_chars) : ( usize , usize , u8 ) ) {
4848 let array = generate_test_data ( string_count, avg_len, unique_chars) ;
4949 let compressor = fsst_train_compressor ( & array) ;
50- bencher. bench ( || fsst_compress ( & array, & compressor) )
50+ bencher
51+ . with_inputs ( || ( & array, & compressor) )
52+ . bench_refs ( |( array, compressor) | fsst_compress ( * array, compressor) )
5153}
5254
5355#[ divan:: bench( args = BENCH_ARGS ) ]
@@ -57,14 +59,16 @@ fn decompress_fsst(bencher: Bencher, (string_count, avg_len, unique_chars): (usi
5759 let encoded = fsst_compress ( array, & compressor) ;
5860
5961 bencher
60- . with_inputs ( || encoded. clone ( ) )
61- . bench_values ( |encoded| encoded. to_canonical ( ) )
62+ . with_inputs ( || & encoded)
63+ . bench_refs ( |encoded| encoded. to_canonical ( ) )
6264}
6365
6466#[ divan:: bench( args = BENCH_ARGS ) ]
6567fn train_compressor ( bencher : Bencher , ( string_count, avg_len, unique_chars) : ( usize , usize , u8 ) ) {
6668 let array = generate_test_data ( string_count, avg_len, unique_chars) ;
67- bencher. bench ( || fsst_train_compressor ( & array) )
69+ bencher
70+ . with_inputs ( || & array)
71+ . bench_refs ( |array| fsst_train_compressor ( array) )
6872}
6973
7074#[ divan:: bench( args = BENCH_ARGS ) ]
@@ -75,7 +79,7 @@ fn pushdown_compare(bencher: Bencher, (string_count, avg_len, unique_chars): (us
7579 let constant = ConstantArray :: new ( Scalar :: from ( & b"const" [ ..] ) , array. len ( ) ) ;
7680
7781 bencher
78- . with_inputs ( || ( fsst_array. clone ( ) , constant. clone ( ) ) )
82+ . with_inputs ( || ( & fsst_array, & constant) )
7983 . bench_refs ( |( fsst_array, constant) | {
8084 compare ( fsst_array. as_ref ( ) , constant. as_ref ( ) , Operator :: Eq ) . unwrap ( ) ;
8185 } )
@@ -92,7 +96,7 @@ fn canonicalize_compare(
9296 let constant = ConstantArray :: new ( Scalar :: from ( & b"const" [ ..] ) , array. len ( ) ) ;
9397
9498 bencher
95- . with_inputs ( || ( fsst_array. clone ( ) , constant. clone ( ) ) )
99+ . with_inputs ( || ( & fsst_array, & constant) )
96100 . bench_refs ( |( fsst_array, constant) | {
97101 compare (
98102 fsst_array. to_canonical ( ) . as_ref ( ) ,
@@ -123,7 +127,7 @@ fn chunked_canonicalize_into(
123127) {
124128 let array = generate_chunked_test_data ( chunk_size, string_count, avg_len, unique_chars) ;
125129
126- bencher. with_inputs ( || array. clone ( ) ) . bench_values ( |array| {
130+ bencher. with_inputs ( || & array) . bench_refs ( |array| {
127131 let mut builder =
128132 VarBinViewBuilder :: with_capacity ( DType :: Binary ( Nullability :: NonNullable ) , array. len ( ) ) ;
129133 array. append_to_builder ( & mut builder) ;
@@ -139,8 +143,8 @@ fn chunked_into_canonical(
139143 let array = generate_chunked_test_data ( chunk_size, string_count, avg_len, unique_chars) ;
140144
141145 bencher
142- . with_inputs ( || array. clone ( ) )
143- . bench_values ( |array| array. to_canonical ( ) ) ;
146+ . with_inputs ( || & array)
147+ . bench_refs ( |array| array. to_canonical ( ) ) ;
144148}
145149
146150/// Helper function to generate random string data.
0 commit comments