Latest Results
perf: type-erase the filesystem into a non-generic ResolverImpl core (#1255)
## What
Refactor `ResolverGeneric<Fs>` into a thin generic shell over a new
non-generic `ResolverImpl` that type-erases the filesystem to `Arc<dyn
FileSystem>`. The heavy resolution algorithm now lives on `ResolverImpl`
and is reached through `ResolverGeneric<Fs>`'s `Deref`, so the public
API is unchanged.
## Why
`ResolverGeneric<Fs>` monomorphizes the entire resolution algorithm once
per `Fs` type **and** once per downstream crate β cross-crate generic
instantiations aren't shared in optimized builds, and fat-LTO doesn't
merge them. In a real consumer (rolldown) the heavy methods
(`load_node_modules`, `package_target_resolve`, `load_tsconfig`,
`load_as_file`, ...) were each emitted **8Γ**. Making the core
non-generic emits it **once**.
## Measured impact (rolldown, fat-LTO release)
- Every heavy resolver method: **8 copies β 1**
- `oxc_resolver` code in the binary: **728 KiB β 282 KiB (β61%)**
- Whole-binary `__text`: **β650 KiB** (downstream generic wrappers
de-duplicate too)
- All existing tests pass; no public API change.
## Perf
Resolution is I/O-bound and the metadata cache absorbs most FS calls, so
the `dyn` dispatch is perf-neutral. An A/B on `benches/resolver.rs`
(static `ResolverGeneric<FileSystemOs>` vs an `Arc<dyn
FileSystem>`-backed resolver) showed **β€0.6%** on the in-memory
benchmark β the worst case, where there are no syscalls to amortize the
vtable against β and **no measurable change** on real-disk resolution.
## Notes
- `FileSystem::new` is gated `where Self: Sized` so the trait is
object-safe; trait objects never call `new`.
- The generic constructors gain `Fs: 'static` (required to coerce into
`Arc<dyn FileSystem>`; satisfied by every real FS type).
- `ResolverImpl` is currently `pub` and reached through `Deref`. If
you'd rather keep it private, the shell can carry explicit forwarding
methods instead β easy to switch.
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Latest Branches
+1%
release-plz-2026-06-18T23-48-37Z -1%
perf/non-generic-resolver-core -4%
codex/release-plz-crates-environment Β© 2026 CodSpeed Technology