@@ -54,15 +54,6 @@ static SESSION: LazyLock<VortexSession> = LazyLock::new(array_session);
5454/// Number of lists in the source array.
5555const NUM_LISTS : usize = 500 ;
5656
57- /// Number of indices to take.
58- ///
59- /// Together with [`LIST_SIZES`] these are sized so the widest type at the largest list size stays
60- /// under 1ms per iteration under codspeed simulation.
61- const NUM_INDICES : & [ usize ] = & [ 10 , 100 ] ;
62-
63- /// Fixed size list lengths (elements per list). See [`NUM_INDICES`].
64- const LIST_SIZES : & [ usize ] = & [ 16 , 64 , 128 , 256 ] ;
65-
6657/// F16 list lengths for isolating the per-index, piecewise, and manual range-copy strategies.
6758const F16_STRATEGY_LIST_SIZES : & [ usize ] = & [ 1 , 2 , 4 , 8 , 16 , 64 , 128 , 256 , 512 , 1024 , 2048 ] ;
6859
9283 FixedSizeListArray :: new ( elements. into_array ( ) , list_size as u32 , validity, num_lists)
9384}
9485
95- fn create_i64_fsl_with_validity (
96- list_size : usize ,
97- num_lists : usize ,
98- validity : Validity ,
99- ) -> FixedSizeListArray {
100- let total_elements = list_size * num_lists;
101- let elements: Buffer < i64 > = ( 0 ..total_elements as i64 ) . collect ( ) ;
102- FixedSizeListArray :: new ( elements. into_array ( ) , list_size as u32 , validity, num_lists)
103- }
104-
10586/// Creates random indices for taking from the array.
10687fn create_random_indices ( num_indices : usize , max_index : usize ) -> Buffer < u64 > {
10788 let mut rng = StdRng :: seed_from_u64 ( 42 ) ;
@@ -215,63 +196,6 @@ fn take_chunked_fsl_sorted<const LIST_SIZE: usize>(bencher: Bencher, num_indices
215196 bench_take_array :: < LIST_SIZE > ( bencher, num_indices, array, true ) ;
216197}
217198
218- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
219- fn take_fsl_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
220- let fsl = create_i64_fsl_with_validity ( LIST_SIZE , NUM_LISTS , Validity :: NonNullable ) ;
221- bench_take_fsl_random :: < i64 , LIST_SIZE > ( bencher, num_indices, fsl) ;
222- }
223-
224- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
225- fn take_fsl_f16_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
226- take_fsl_random_typed :: < f16 , LIST_SIZE > ( bencher, num_indices) ;
227- }
228-
229- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
230- fn take_fsl_u8_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
231- take_fsl_random_typed :: < u8 , LIST_SIZE > ( bencher, num_indices) ;
232- }
233-
234- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
235- fn take_fsl_u32_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
236- take_fsl_random_typed :: < u32 , LIST_SIZE > ( bencher, num_indices) ;
237- }
238-
239- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
240- fn take_fsl_u64_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
241- take_fsl_random_typed :: < u64 , LIST_SIZE > ( bencher, num_indices) ;
242- }
243-
244- fn take_fsl_random_typed < T , const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize )
245- where
246- T : NativePType + FromPrimitive ,
247- {
248- let fsl = create_fsl :: < T > ( LIST_SIZE , NUM_LISTS ) ;
249- bench_take_fsl_random :: < T , LIST_SIZE > ( bencher, num_indices, fsl) ;
250- }
251-
252- fn bench_take_fsl_random < T , const LIST_SIZE : usize > (
253- bencher : Bencher ,
254- num_indices : usize ,
255- fsl : FixedSizeListArray ,
256- ) where
257- T : NativePType ,
258- {
259- let indices = create_random_indices ( num_indices, NUM_LISTS ) ;
260- let indices_array = indices. into_array ( ) ;
261-
262- bencher
263- . counter ( BytesCount :: of_many :: < T > ( num_indices * LIST_SIZE ) )
264- . with_inputs ( || ( & fsl, & indices_array, SESSION . create_execution_ctx ( ) ) )
265- . bench_refs ( |( array, indices, execution_ctx) | {
266- array
267- . clone ( )
268- . take ( indices. clone ( ) )
269- . unwrap ( )
270- . execute :: < RecursiveCanonical > ( execution_ctx)
271- . unwrap ( )
272- } ) ;
273- }
274-
275199#[ divan:: bench( args = F16_STRATEGY_NUM_INDICES , consts = F16_STRATEGY_LIST_SIZES ) ]
276200fn take_fsl_f16_force_per_index < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
277201 let fsl = create_fsl :: < f16 > ( LIST_SIZE , NUM_LISTS ) ;
@@ -427,30 +351,3 @@ fn take_fsl_f16_manual_range_copy_strategy<const LIST_SIZE: usize>(
427351 )
428352 }
429353}
430-
431- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
432- fn take_fsl_nullable_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
433- // Create validity with ~10% nulls
434- let mut rng = StdRng :: seed_from_u64 ( 123 ) ;
435- let validity = Validity :: from_iter ( ( 0 ..NUM_LISTS ) . map ( |_| rng. random_ratio ( 9 , 10 ) ) ) ;
436-
437- let fsl = create_i64_fsl_with_validity ( LIST_SIZE , NUM_LISTS , validity) ;
438- bench_take_fsl_random :: < i64 , LIST_SIZE > ( bencher, num_indices, fsl) ;
439- }
440-
441- #[ divan:: bench( args = NUM_INDICES , consts = LIST_SIZES ) ]
442- fn take_fsl_f16_nullable_random < const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize ) {
443- take_fsl_nullable_random_typed :: < f16 , LIST_SIZE > ( bencher, num_indices) ;
444- }
445-
446- fn take_fsl_nullable_random_typed < T , const LIST_SIZE : usize > ( bencher : Bencher , num_indices : usize )
447- where
448- T : NativePType + FromPrimitive ,
449- {
450- // Create validity with ~10% nulls
451- let mut rng = StdRng :: seed_from_u64 ( 123 ) ;
452- let validity = Validity :: from_iter ( ( 0 ..NUM_LISTS ) . map ( |_| rng. random_ratio ( 9 , 10 ) ) ) ;
453-
454- let fsl = create_fsl_with_validity :: < T > ( LIST_SIZE , NUM_LISTS , validity) ;
455- bench_take_fsl_random :: < T , LIST_SIZE > ( bencher, num_indices, fsl) ;
456- }
0 commit comments