From 47fd83da5789bd8e1205a29c9ba28a336e04d49c Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 24 May 2017 15:48:43 +0200 Subject: [PATCH] Add a fast path for eq_ignore_ascii_case. --- components/style/gecko_string_cache/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/style/gecko_string_cache/mod.rs b/components/style/gecko_string_cache/mod.rs index fa89f5eab48..4973428f1e8 100644 --- a/components/style/gecko_string_cache/mod.rs +++ b/components/style/gecko_string_cache/mod.rs @@ -239,6 +239,10 @@ impl Atom { /// Return whether two atoms are ASCII-case-insensitive matches pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool { + if self == other { + return true; + } + let a = self.as_slice(); let b = other.as_slice(); a.len() == b.len() && a.iter().zip(b).all(|(&a16, &b16)| {