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:
The8472 2021-06-09 23:11:07 +02:00
parent 47d38752c6
commit 53d71c181e

View file

@ -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())
}
}