Skip to content

Commit

Permalink
perf(rust, python): use hash set in drop_many (#9807)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored Jul 11, 2023
1 parent f5f0630 commit 243951c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions polars/polars-core/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@ impl DataFrame {
}

pub fn drop_many<S: AsRef<str>>(&self, names: &[S]) -> Self {
let names = names.iter().map(|s| s.as_ref()).collect();
fn inner(df: &DataFrame, names: Vec<&str>) -> DataFrame {
let names: PlHashSet<_> = names.iter().map(|s| s.as_ref()).collect();
fn inner(df: &DataFrame, names: PlHashSet<&str>) -> DataFrame {
let mut new_cols = Vec::with_capacity(df.columns.len() - names.len());
df.columns.iter().for_each(|s| {
if !names.contains(&s.name()) {
Expand Down

0 comments on commit 243951c

Please sign in to comment.