Skip to content

Commit

Permalink
perf: don't trigger internal borrwing in numpy memmap (pola-rs#13304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Dec 29, 2023
1 parent 595bfe4 commit 5484a98
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions py-polars/src/series/construction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ fn mmap_numpy_array<T: Element + NativeType>(
name: &str,
array: &PyArray1<T>,
) -> PySeries {
let ro_array = array.readonly();
let vals = ro_array.as_slice().unwrap();
let vals = unsafe { array.as_slice().unwrap() };

let arr = unsafe { arrow::ffi::mmap::slice_and_owner(vals, array.to_object(py)) };
Series::from_arrow(name, arr.to_boxed()).unwrap().into()
Expand Down

0 comments on commit 5484a98

Please sign in to comment.