Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Speed up the offsets checking (#1684)
* simplify offsets fully checking Signed-off-by: remzi <13716567376yh@gmail.com> * update doc rename to offsets buffer Signed-off-by: remzi <13716567376yh@gmail.com> * add more tests for empty binary-like array Signed-off-by: remzi <13716567376yh@gmail.com> * add docs for empty binary-like array Signed-off-by: remzi <13716567376yh@gmail.com> * Update arrow/src/array/data.rs fix a nit in docs. Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com> * add benchmark Signed-off-by: remzi <13716567376yh@gmail.com> * replace windows with scan Signed-off-by: remzi <13716567376yh@gmail.com> * Update arrow/src/array/data.rs Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com> * Update arrow/src/array/data.rs Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com> Co-authored-by: Liang-Chi Hsieh <viirya@gmail.com>
- Loading branch information
1 parent
5b154ea
commit ff182f167e83b1fc553e213ca208bb82a28dea91
Showing
3 changed files
with
187 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -176,3 +176,7 @@ harness = false | ||
[[bench]] | ||
name = "string_kernels" | ||
harness = false | ||
|
||
[[bench]] | ||
name = "array_data_validate" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,48 @@ | ||
// 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. | ||
|
||
#[macro_use] | ||
extern crate criterion; | ||
use criterion::Criterion; | ||
|
||
extern crate arrow; | ||
|
||
use arrow::{array::*, buffer::Buffer, datatypes::DataType}; | ||
|
||
fn create_binary_array_data(length: i32) -> ArrayData { | ||
let value_buffer = Buffer::from_iter(0_i32..length); | ||
let offsets_buffer = Buffer::from_iter(0_i32..length + 1); | ||
ArrayData::try_new( | ||
DataType::Binary, | ||
length as usize, | ||
None, | ||
None, | ||
0, | ||
vec![offsets_buffer, value_buffer], | ||
vec![], | ||
) | ||
.unwrap() | ||
} | ||
|
||
fn array_slice_benchmark(c: &mut Criterion) { | ||
c.bench_function("validate_binary_array_data 20000", |b| { | ||
b.iter(|| create_binary_array_data(20000)) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, array_slice_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters