-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Re-implement some Parquet decode methods without `copy_nonoverla…
…pping` (#558) * Re-implement int decode methods using safe code * fix * fix tests * more tests * fix * fix * re-implement using unsafe read/write unaligned and add benchmark * lint * macros * more macros * combine macros * replace another impl with the macro * fix a regression * remove zero_value arg from generate_cast_to_signed and rename impl_plain_decoding_int to the original name of make_int_variant_impl
- Loading branch information
Showing
4 changed files
with
203 additions
and
44 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 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_buffer::ToByteSlice; | ||
use comet::parquet::read::values::{copy_i32_to_i16, copy_i32_to_u16}; | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
let num = 1000; | ||
let source = vec![78_i8; num * 4]; | ||
let mut group = c.benchmark_group("parquet_decode"); | ||
group.bench_function("decode_i32_to_i16", |b| { | ||
let mut dest: Vec<u8> = vec![b' '; num * 2]; | ||
b.iter(|| { | ||
copy_i32_to_i16(source.to_byte_slice(), dest.as_mut_slice(), num); | ||
}); | ||
}); | ||
group.bench_function("decode_i32_to_u16", |b| { | ||
let mut dest: Vec<u8> = vec![b' '; num * 4]; | ||
b.iter(|| { | ||
copy_i32_to_u16(source.to_byte_slice(), dest.as_mut_slice(), num); | ||
}); | ||
}); | ||
} | ||
|
||
// Create UTF8 batch with strings representing ints, floats, nulls | ||
fn config() -> Criterion { | ||
Criterion::default() | ||
} | ||
|
||
criterion_group! { | ||
name = benches; | ||
config = config(); | ||
targets = criterion_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