Skip to content

Commit

Permalink
remove unsafe in benches
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Oct 10, 2021
1 parent 49ef9d7 commit 92e4789
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions arrow/benches/array_from_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,11 @@ use criterion::Criterion;
extern crate arrow;

use arrow::array::*;
use arrow::buffer::Buffer;
use arrow::datatypes::*;
use std::{convert::TryFrom, sync::Arc};

fn array_from_vec(n: usize) {
let mut v: Vec<u8> = Vec::with_capacity(n);
for i in 0..n {
v.push((i & 0xffff) as u8);
}
let arr_data = unsafe {
ArrayDataBuilder::new(DataType::Int32)
.add_buffer(Buffer::from(v))
.build_unchecked()
};
criterion::black_box(Int32Array::from(arr_data));
let v: Vec<i32> = (0..n as i32).collect();
criterion::black_box(Int32Array::from(v));
}

fn array_string_from_vec(n: usize) {
Expand Down

0 comments on commit 92e4789

Please sign in to comment.