Rich-T-kid commented on code in PR #10809: URL: https://github.com/apache/arrow-rs/pull/10809#discussion_r3839378488
########## arrow-array/benches/run_array.rs: ########## @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use arrow_array::types::Int32Type; +use arrow_array::{Int32Array, RunArray, StringArray}; +use criterion::*; +use std::hint; + +fn criterion_benchmark(c: &mut Criterion) { + for physical_array_len in [256, 1024, 4096, 8192] { + // Strictly increasing, strictly positive run ends `[1, 2, ..., physical]`, + // with one value per run. + let run_ends = Int32Array::from_iter_values(1..=physical_array_len); + + // Primitive (i32) values. Review Comment: unneeded comment ########## arrow-array/benches/run_array.rs: ########## @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use arrow_array::types::Int32Type; +use arrow_array::{Int32Array, RunArray, StringArray}; +use criterion::*; +use std::hint; + +fn criterion_benchmark(c: &mut Criterion) { + for physical_array_len in [256, 1024, 4096, 8192] { + // Strictly increasing, strictly positive run ends `[1, 2, ..., physical]`, + // with one value per run. + let run_ends = Int32Array::from_iter_values(1..=physical_array_len); + + // Primitive (i32) values. + let i32_values = Int32Array::from_iter_values(0..physical_array_len); + c.bench_function( + &format!("try_new(values: i32, physical_array_len: {physical_array_len})"), + |b| { + b.iter(|| { + hint::black_box( + RunArray::<Int32Type>::try_new(&run_ends, &i32_values).unwrap(), + ); + }); + }, + ); + + // Utf8 (string) values. Review Comment: unneeded comment ########## arrow-array/benches/run_array.rs: ########## @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use arrow_array::types::Int32Type; +use arrow_array::{Int32Array, RunArray, StringArray}; +use criterion::*; +use std::hint; + +fn criterion_benchmark(c: &mut Criterion) { + for physical_array_len in [256, 1024, 4096, 8192] { + // Strictly increasing, strictly positive run ends `[1, 2, ..., physical]`, + // with one value per run. + let run_ends = Int32Array::from_iter_values(1..=physical_array_len); Review Comment: 🤔, this makes for the opposite case of when you'd want to use a REE. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
