Revert "perf(alias): short-circuit load_alias with a 1+2 byte prefix index"#230
Conversation
…index (#…" This reverts commit 3e0aa8f.
There was a problem hiding this comment.
Pull request overview
This PR reverts the previously introduced alias “prefix-byte accelerator” optimization (#225), restoring the prior alias matching behavior in load_alias.
Changes:
- Removes the
AliasFirstBytesprecomputed prefix index and the associated fast-path short-circuiting inResolverGeneric::load_alias. - Simplifies
ResolverGenericconstruction by dropping the now-unneeded alias/fallback prefix index fields. - Removes the regression test that covered empty alias keys matching slash-prefixed specifiers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/lib.rs |
Reverts the alias prefix-byte accelerator and restores the original load_alias signature/logic. |
src/tests/alias.rs |
Removes the regression test that was added for the reverted optimization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -333,25 +333,3 @@ async fn alias_try_fragment_as_path() { | |||
| let resolution = resolver.resolve(&f, "#/a").await.map(|r| r.full_path()); | |||
| assert_eq!(resolution, Ok(f.join("#").join("a.js"))); | |||
| } | |||
Merging this PR will degrade performance by 5.84%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | resolver[pnp resolve] |
8.8 KB | 8.4 KB | +4.74% |
| ❌ | Simulation | resolver[pnp resolve] |
255.5 µs | 264.9 µs | -3.55% |
| ❌ | Simulation | resolver[single-thread] |
50.2 ms | 52.2 ms | -3.84% |
| ❌ | Simulation | resolver[resolve from symlinks] |
144.6 ms | 160.4 ms | -9.86% |
| ❌ | Simulation | resolver[resolve from symlinks multi thread] |
82.3 ms | 97.4 ms | -15.48% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing revert-225-perf/alias-first-byte-index (f7472d5) with main (e836a64)
Reverts #225
I prefer a trie similar match other than this.