Skip to content

Commit

Permalink
perf(rust, python): improve pivot performance by using faster series… (
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Oct 12, 2022
1 parent f8f3af9 commit 9ec084c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions polars/polars-ops/src/pivot/positioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(super) fn position_aggregates(
for ((row_idx, col_idx), val) in row_locations
.iter()
.zip(col_locations)
.zip(value_agg_phys.iter())
.zip(value_agg_phys.phys_iter())
{
// Safety:
// in bounds
Expand Down Expand Up @@ -162,7 +162,7 @@ pub(super) fn compute_col_idx(
let mut col_to_idx = PlHashMap::with_capacity(HASHMAP_INIT_SIZE);
let mut idx = 0 as IdxSize;
column_agg_physical
.iter()
.phys_iter()
.map(|v| {
let idx = *col_to_idx.entry(v).or_insert_with(|| {
let old_idx = idx;
Expand Down Expand Up @@ -248,7 +248,7 @@ pub(super) fn compute_row_idx(
PlIndexMap::with_capacity_and_hasher(HASHMAP_INIT_SIZE, Default::default());
let mut idx = 0 as IdxSize;
let row_locations = index_agg_physical
.iter()
.phys_iter()
.map(|v| {
let idx = *row_to_idx.entry(v).or_insert_with(|| {
let old_idx = idx;
Expand Down Expand Up @@ -282,7 +282,7 @@ pub(super) fn compute_row_idx(
.collect::<Vec<_>>();
let mut iters = index_agg_physical
.iter()
.map(|s| s.iter())
.map(|s| s.phys_iter())
.collect::<Vec<_>>();
let mut row_to_idx =
PlIndexMap::with_capacity_and_hasher(HASHMAP_INIT_SIZE, Default::default());
Expand Down
13 changes: 13 additions & 0 deletions py-polars/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ec084c

Please sign in to comment.