Rollup merge of #17022 - bholley:atom_fast_path, r=nox

Add a fast path for eq_ignore_ascii_case

Per https://bugzilla.mozilla.org/show_bug.cgi?id=1363778#c6

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17022)
<!-- Reviewable:end -->
This commit is contained in:
Manish Goregaokar 2017-05-24 11:59:34 -07:00 committed by GitHub
commit 8c9c506f90

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)| {