diff options
| author | The8472 <git@infinite-source.de> | 2021-06-09 23:11:07 +0200 |
|---|---|---|
| committer | The8472 <git@infinite-source.de> | 2021-06-09 23:11:07 +0200 |
| commit | 53d71c181e53be51a1e122146c504e758f304c38 (patch) | |
| tree | fd23fb9e907a15858b37b16f9014f083e592726d /library/std/src | |
| parent | 47d38752c65359e1f4558d7a06935982fb8b486f (diff) | |
| download | rust-53d71c181e53be51a1e122146c504e758f304c38.tar.gz rust-53d71c181e53be51a1e122146c504e758f304c38.zip | |
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.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/path.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs index ede147aca12..6ccf4c9656e 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -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()) } } |
