Skip to content

feat: use oxc_resolver#32

Merged
underfin merged 1 commit intomainfrom
oxc-resolver
Oct 7, 2023
Merged

feat: use oxc_resolver#32
underfin merged 1 commit intomainfrom
oxc-resolver

Conversation

@underfin
Copy link
Copy Markdown
Contributor

@underfin underfin commented Oct 7, 2023

Description

closed #29

Test Plan


@underfin
Copy link
Copy Markdown
Contributor Author

underfin commented Oct 7, 2023

!bench

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 7, 2023

Benchmark Results

group                            baseline                               pr
-----                            --------                               --
rolldown benchmark/threejs       1.00     65.0±5.78ms        ? ?/sec    1.00     65.1±4.51ms        ? ?/sec
rolldown benchmark/threejs10x    1.00   672.1±26.70ms        ? ?/sec    1.00   669.2±25.28ms        ? ?/sec

@underfin underfin merged commit 79de1ad into main Oct 7, 2023
@underfin underfin deleted the oxc-resolver branch October 7, 2023 13:00
graphite-app bot pushed a commit that referenced this pull request Feb 23, 2026
## Summary

Bump `sugar_path` from 1.2.1 to 2^

### What changed in sugar_path 2.0

The 2.0 release is focused on reducing allocations in hot paths. The key optimizations:

- **`normalize()` returns `Cow<'_, Path>` instead of `PathBuf`** — a `needs_normalization()` fast-path check (using `memchr`) detects already-clean paths and returns `Cow::Borrowed` with zero allocation ([#32](hyf0/sugar_path#32))
- **`absolutize()` / `absolutize_with()` return `Cow<'_, Path>`** — same idea: already-absolute clean paths are returned borrowed ([#34](hyf0/sugar_path#34))
- **`memchr`-accelerated fast path for `relative()`** — replaces the component-iterator approach with SIMD-accelerated `/` scanning, avoids the `absolutize()` → `current_dir()` syscall when both paths are already absolute, and uses `SmallVec<[&str; 8]>` to stay on the stack ([#27](hyf0/sugar_path#27))
- **Reduced allocations across the board** — reuse buffers, `SmallVec` for component lists, avoid `collect()` into `Vec` ([#26](hyf0/sugar_path#26))

### Breaking change

`normalize()`, `absolutize()`, and `absolutize_with()` now return `Cow<'_, Path>` instead of `PathBuf`. Call sites that need an owned `PathBuf` require `.into_owned()`, and chained operations like `.join().normalize().to_slash_lossy()` need to be split so the intermediate `Cow` lives long enough.

## Test plan

- [x] CI passes (same API surface, just `Cow` unwrapping at call sites)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use oxc_resolver

2 participants