Skip to content

Commit

Permalink
perf(rust, python): impove performance reducing window functions with…
Browse files Browse the repository at this point in the history
… numeric output `~-14%` (#5841)
  • Loading branch information
ritchie46 committed Dec 18, 2022
1 parent 33d2a11 commit eb3c6c1
Show file tree
Hide file tree
Showing 3 changed files with 370 additions and 181 deletions.
4 changes: 4 additions & 0 deletions polars/polars-core/src/frame/groupby/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ impl<'df> GroupBy<'df> {
self.groups
}

pub fn take_groups_mut(&mut self) -> GroupsProxy {
std::mem::take(&mut self.groups)
}

pub fn keys_sliced(&self, slice: Option<(i64, usize)>) -> Vec<Series> {
#[allow(unused_assignments)]
// needed to keep the lifetimes valid for this scope
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-lazy/src/physical_plan/expressions/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl PhysicalExpr for TakeExpr {
};
let taken = ac.flat_naive().take(&idx.into_inner())?;
ac.with_series(taken, true);
ac.with_update_groups(UpdateGroups::WithSeriesLen);
ac.with_update_groups(UpdateGroups::WithGroupsLen);
Ok(ac)
}
}
Expand Down

0 comments on commit eb3c6c1

Please sign in to comment.