Skip to content

Commit

Permalink
String comparison optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Jan 25, 2024
1 parent df28170 commit 7697163
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pub fn strings_are_equal_ci(a: &str, b: &str) -> bool {
let mut a_it = a.bytes();
let mut b_it = b.bytes();

if a.len() != b.len() {
return false;
}

loop {
match (a_it.next(), b_it.next()) {
(Some(a_val), Some(b_val)) => {
Expand Down

0 comments on commit 7697163

Please sign in to comment.