BurntSushi / BurntSushi/rust-csv
Performance issue with the redundancy operations
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/BurntSushi/rust-csv/blob/41c71ed353a71526c52633d854466c1619dacae4/csv-core/src/reader.rs#L669
For this line of code, it will always update the value of `self.line`, even if the value of it does not change. This introduces some redundant operations.
If we change the code to this, we can eliminate these redundant operations.
```
if input[nin] == b'\n'{
self.line += 1;
}
```
According to my tests with the ema example with this application (https://github.com/greyblake/ta-rs), the average execution time decreased from 2.74s to 2.68s, which is a 1.02x speedup.
Hope this information helps!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.