Add a fast path for eq_ignore_ascii_case.

This commit is contained in:
Bobby Holley 2017-05-24 15:48:43 +02:00
parent 98edf5d54d
commit 47fd83da57

View file

@ -239,6 +239,10 @@ impl Atom {
/// Return whether two atoms are ASCII-case-insensitive matches /// Return whether two atoms are ASCII-case-insensitive matches
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool { pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
if self == other {
return true;
}
let a = self.as_slice(); let a = self.as_slice();
let b = other.as_slice(); let b = other.as_slice();
a.len() == b.len() && a.iter().zip(b).all(|(&a16, &b16)| { a.len() == b.len() && a.iter().zip(b).all(|(&a16, &b16)| {