Skip to content

Commit

Permalink
validate: micro-optimizations
Browse files Browse the repository at this point in the history
- remove unneeded derive debug
- prealloc memory used in hot loop
  • Loading branch information
jqnatividad committed Sep 26, 2024
1 parent 5fef7f3 commit 42b4c25
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/cmd/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ fn currency_format_checker(s: &str) -> bool {
})
}

#[derive(Debug)]
struct DynEnumValidator {
dynenum_set: HashSet<String>,
}
Expand Down Expand Up @@ -645,7 +644,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
let mut invalid_count: u64 = 0;

// amortize memory allocation by reusing record
let mut record = csv::ByteRecord::new();
let mut record = csv::ByteRecord::with_capacity(500, header_len);
// reuse batch buffer
let batch_size = if args.flag_batch == 0 {
util::count_rows(&rconfig)? as usize
Expand Down

0 comments on commit 42b4c25

Please sign in to comment.