mirror of
https://github.com/rust-lang/rust
synced 2024-10-14 12:33:57 +00:00
optimize Eq implementation for paths
Filesystems generally have a tree-ish structure which means paths are more likely to share a prefix than a suffix. Absolute paths are especially prone to share long prefixes.
This commit is contained in:
parent
47d38752c6
commit
53d71c181e
|
@ -951,7 +951,7 @@ impl FusedIterator for Components<'_> {}
|
|||
impl<'a> cmp::PartialEq for Components<'a> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Components<'a>) -> bool {
|
||||
Iterator::eq(self.clone(), other.clone())
|
||||
Iterator::eq(self.clone().rev(), other.clone().rev())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue