From 904415d05478eab7207b27af400d2b9cb7ea0c27 Mon Sep 17 00:00:00 2001 From: yyzdtccjdtc Date: Wed, 1 Jun 2022 09:43:00 -0700 Subject: [PATCH] optimization for eliminating redundant memory operations --- csv-core/src/reader.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/csv-core/src/reader.rs b/csv-core/src/reader.rs index dbd6dc3..c5a7acf 100644 --- a/csv-core/src/reader.rs +++ b/csv-core/src/reader.rs @@ -666,7 +666,9 @@ impl Reader { let mut state = self.dfa_state; while nin < input.len() && nout < output.len() && nend < ends.len() { let (s, has_out) = self.dfa.get_output(state, input[nin]); - self.line += (input[nin] == b'\n') as u64; + if input[nin] == b'\n'{ + self.line += 1; + } state = s; if has_out { output[nout] = input[nin];