@@ -39,26 +39,30 @@ static SESSION: LazyLock<VortexSession> =
3939fn chunked_bool_canonical_into ( bencher : Bencher , ( len, chunk_count) : ( usize , usize ) ) {
4040 let chunk = make_bool_chunks ( len, chunk_count) ;
4141
42- bencher. with_inputs ( || & chunk) . bench_refs ( |chunk| {
43- let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
44- chunk
45- . append_to_builder ( builder. as_mut ( ) , & mut SESSION . create_execution_ctx ( ) )
46- . vortex_expect ( "append failed" ) ;
47- builder. finish ( )
48- } )
42+ bencher
43+ . with_inputs ( || ( & chunk, SESSION . create_execution_ctx ( ) ) )
44+ . bench_refs ( |( chunk, ctx) | {
45+ let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
46+ chunk
47+ . append_to_builder ( builder. as_mut ( ) , ctx)
48+ . vortex_expect ( "append failed" ) ;
49+ builder. finish ( )
50+ } )
4951}
5052
5153#[ divan:: bench( args = BENCH_ARGS ) ]
5254fn chunked_opt_bool_canonical_into ( bencher : Bencher , ( len, chunk_count) : ( usize , usize ) ) {
5355 let chunk = make_opt_bool_chunks ( len, chunk_count) ;
5456
55- bencher. with_inputs ( || & chunk) . bench_refs ( |chunk| {
56- let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
57- chunk
58- . append_to_builder ( builder. as_mut ( ) , & mut SESSION . create_execution_ctx ( ) )
59- . vortex_expect ( "append failed" ) ;
60- builder. finish ( )
61- } )
57+ bencher
58+ . with_inputs ( || ( & chunk, SESSION . create_execution_ctx ( ) ) )
59+ . bench_refs ( |( chunk, ctx) | {
60+ let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
61+ chunk
62+ . append_to_builder ( builder. as_mut ( ) , ctx)
63+ . vortex_expect ( "append failed" ) ;
64+ builder. finish ( )
65+ } )
6266}
6367
6468#[ divan:: bench( args = BENCH_ARGS ) ]
@@ -74,16 +78,18 @@ fn chunked_opt_bool_into_canonical(bencher: Bencher, (len, chunk_count): (usize,
7478fn chunked_varbinview_canonical_into ( bencher : Bencher , ( len, chunk_count) : ( usize , usize ) ) {
7579 let chunks = make_string_chunks ( false , len, chunk_count) ;
7680
77- bencher. with_inputs ( || & chunks) . bench_refs ( |chunk| {
78- let mut builder = VarBinViewBuilder :: with_capacity (
79- DType :: Utf8 ( chunk. dtype ( ) . nullability ( ) ) ,
80- len * chunk_count,
81- ) ;
82- chunk
83- . append_to_builder ( & mut builder, & mut SESSION . create_execution_ctx ( ) )
84- . vortex_expect ( "append failed" ) ;
85- builder. finish ( )
86- } )
81+ bencher
82+ . with_inputs ( || ( & chunks, SESSION . create_execution_ctx ( ) ) )
83+ . bench_refs ( |( chunk, ctx) | {
84+ let mut builder = VarBinViewBuilder :: with_capacity (
85+ DType :: Utf8 ( chunk. dtype ( ) . nullability ( ) ) ,
86+ len * chunk_count,
87+ ) ;
88+ chunk
89+ . append_to_builder ( & mut builder, ctx)
90+ . vortex_expect ( "append failed" ) ;
91+ builder. finish ( )
92+ } )
8793}
8894
8995#[ divan:: bench( args = BENCH_ARGS ) ]
@@ -99,16 +105,18 @@ fn chunked_varbinview_into_canonical(bencher: Bencher, (len, chunk_count): (usiz
99105fn chunked_varbinview_opt_canonical_into ( bencher : Bencher , ( len, chunk_count) : ( usize , usize ) ) {
100106 let chunks = make_string_chunks ( true , len, chunk_count) ;
101107
102- bencher. with_inputs ( || & chunks) . bench_refs ( |chunk| {
103- let mut builder = VarBinViewBuilder :: with_capacity (
104- DType :: Utf8 ( chunk. dtype ( ) . nullability ( ) ) ,
105- len * chunk_count,
106- ) ;
107- chunk
108- . append_to_builder ( & mut builder, & mut SESSION . create_execution_ctx ( ) )
109- . vortex_expect ( "append failed" ) ;
110- builder. finish ( )
111- } )
108+ bencher
109+ . with_inputs ( || ( & chunks, SESSION . create_execution_ctx ( ) ) )
110+ . bench_refs ( |( chunk, ctx) | {
111+ let mut builder = VarBinViewBuilder :: with_capacity (
112+ DType :: Utf8 ( chunk. dtype ( ) . nullability ( ) ) ,
113+ len * chunk_count,
114+ ) ;
115+ chunk
116+ . append_to_builder ( & mut builder, ctx)
117+ . vortex_expect ( "append failed" ) ;
118+ builder. finish ( )
119+ } )
112120}
113121
114122#[ divan:: bench( args = BENCH_ARGS ) ]
@@ -124,13 +132,15 @@ fn chunked_varbinview_opt_into_canonical(bencher: Bencher, (len, chunk_count): (
124132fn chunked_constant_i32_append_to_builder ( bencher : Bencher , ( len, chunk_count) : ( usize , usize ) ) {
125133 let chunk = make_constant_i32_chunks ( len, chunk_count) ;
126134
127- bencher. with_inputs ( || & chunk) . bench_refs ( |chunk| {
128- let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
129- chunk
130- . append_to_builder ( builder. as_mut ( ) , & mut SESSION . create_execution_ctx ( ) )
131- . vortex_expect ( "append failed" ) ;
132- builder. finish ( )
133- } )
135+ bencher
136+ . with_inputs ( || ( & chunk, SESSION . create_execution_ctx ( ) ) )
137+ . bench_refs ( |( chunk, ctx) | {
138+ let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
139+ chunk
140+ . append_to_builder ( builder. as_mut ( ) , ctx)
141+ . vortex_expect ( "append failed" ) ;
142+ builder. finish ( )
143+ } )
134144}
135145
136146const CONSTANT_UTF8_BENCH_ARGS : & [ ( & str , usize , usize ) ] = & [
@@ -146,13 +156,15 @@ fn chunked_constant_utf8_append_to_builder(
146156) {
147157 let chunk = make_constant_utf8_chunks ( value, len, chunk_count) ;
148158
149- bencher. with_inputs ( || & chunk) . bench_refs ( |chunk| {
150- let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
151- chunk
152- . append_to_builder ( builder. as_mut ( ) , & mut SESSION . create_execution_ctx ( ) )
153- . vortex_expect ( "append failed" ) ;
154- builder. finish ( )
155- } )
159+ bencher
160+ . with_inputs ( || ( & chunk, SESSION . create_execution_ctx ( ) ) )
161+ . bench_refs ( |( chunk, ctx) | {
162+ let mut builder = builder_with_capacity ( chunk. dtype ( ) , len * chunk_count) ;
163+ chunk
164+ . append_to_builder ( builder. as_mut ( ) , ctx)
165+ . vortex_expect ( "append failed" ) ;
166+ builder. finish ( )
167+ } )
156168}
157169
158170fn make_constant_utf8_chunks ( value : & str , len : usize , chunk_count : usize ) -> ArrayRef {
0 commit comments