Skip to content

Commit

Permalink
perf(rust, polars): use iterator instead of loop `polars_io::csv::par…
Browse files Browse the repository at this point in the history
…ser::skip_condition` (#5157)

Co-authored-by: Danny van Kooten <dannyvankooten@users.noreply.github.com>
  • Loading branch information
dannyvankooten and dannyvankooten authored Dec 27, 2022
1 parent 7e1ddb9 commit 52295bb
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions polars/polars-io/src/csv/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,8 @@ where
if input.is_empty() {
return input;
}
let mut read = 0;
let len = input.len();
while read < len {
let b = input[read];
if !f(b) {
break;
}
read += 1;
}

let read = input.iter().position(|b| !f(*b)).unwrap_or(input.len());
&input[read..]
}

Expand Down

0 comments on commit 52295bb

Please sign in to comment.