Avatar for the oxc-project user
oxc-project
oxc-resolver
BlogDocsChangelog

perf: improve call to `Path::ends_with`

#199Merged
Comparing
perf-ends-with
(
1e02488
) with
main
(
94efa90
)
CodSpeed Performance Gauge
0%
Improvements
0
Regressions
0
Untouched
2
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

resolver[single-thread]
benches/resolver.rs::resolver::bench_resolver::resolver[single-thread]
CodSpeed Performance Gauge
+1%
460.9 µs
455.7 µs
resolver[multi-thread]
benches/resolver.rs::resolver::bench_resolver::resolver[multi-thread]
CodSpeed Performance Gauge
-2%
484.2 µs
491.8 µs

Commits

Click on a commit to change the comparison range
Base
main
94efa90
0%
perf: improve call to `Path::ends_with` `Path::ends_with` converts the comparator to a `Path` and compares all components. `module_name` in `cached_path.path().ends_with(module_name)` is guaranteed to be a single component so this overhead can be avoided. ```rust #[must_use] pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool { self._ends_with(child.as_ref()) } fn _ends_with(&self, child: &Path) -> bool { iter_after(self.components().rev(), child.components().rev()).is_some() } ```
1e02488
1 year ago
by Boshen
© 2025 CodSpeed Technology
Home Terms Privacy Docs