Skip to content

Commit

Permalink
Reduce compile branches in Series
Browse files Browse the repository at this point in the history
All the data types are backed by a physical type in memory e.g. Date32 -> i32, Date64 -> i64.

Series lead to code implementations of all traits. Whereas there are a lot of duplicates due to
data types being backed by the same physical type. In this commit we reduce compile times by
opting for a little more run time cost. We cast to the physical type -> apply the operation and
(depending on the result) cast back to the original type
  • Loading branch information
ritchie46 committed Mar 31, 2021
1 parent d26ca61 commit edffc98
Show file tree
Hide file tree
Showing 5 changed files with 1,061 additions and 284 deletions.
6 changes: 3 additions & 3 deletions polars/polars-core/src/chunked_array/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::chunked_array::builder::get_list_builder;
#[cfg(feature = "object")]
use crate::chunked_array::object::ObjectType;
use crate::prelude::*;
use crate::series::implementations::Wrap;
use crate::series::implementations::SeriesWrap;
use crate::utils::NoNull;
use arrow::array::{ArrayRef, UInt32Array};
use std::marker::Sized;
Expand Down Expand Up @@ -277,11 +277,11 @@ where
}
}

impl<'a, INulls> From<Wrap<INulls>> for TakeIdx<'a, Dummy<usize>, INulls>
impl<'a, INulls> From<SeriesWrap<INulls>> for TakeIdx<'a, Dummy<usize>, INulls>
where
INulls: Iterator<Item = Option<usize>>,
{
fn from(iter: Wrap<INulls>) -> Self {
fn from(iter: SeriesWrap<INulls>) -> Self {
TakeIdx::IterNulls(iter.0)
}
}
Expand Down

0 comments on commit edffc98

Please sign in to comment.