Latest Results
perf(specifier): SIMD fast-reject of specifiers without query/fragment (#1234)
## What
`cargo asm` shows `Specifier::parse_query_fragment` scanning every
specifier **byte-by-byte** through a stateful loop — tracking
`query_start`, `fragment_start`, and `prev` (for escaped `#`) — to
locate `?`/`#`. This runs on **every resolve**, but the vast majority of
specifiers (`./components/Button`, `react`, `@scope/pkg`) contain
neither character.
Fast-reject the common case with `memchr2`: if the specifier carries no
`?`/`#`, return the borrowed specifier immediately and skip the stateful
loop (and its `prev`/`escaped_indexes` bookkeeping). When a `?`/`#` *is*
present, the original loop runs unchanged.
## On the `memchr` dependency
`memchr` is **already linked** — pulled in by `json-strip-comments`
(tsconfig comment stripping) and `serde_json` (JSON parsing), both of
which actively use it — so declaring it a direct dependency adds **zero
binary size**; it just references already-present code. `cargo-shear` is
clean (the dep is used).
## Results
| version | `resolver_memory/single-thread` |
| --- | --- |
| original (stateful loop) | baseline |
| scalar `any` fast-reject | ~0.5% faster |
| **`memchr2` fast-reject** | **~1.2% faster** (−0.68% vs scalar,
p=0.01) |
In an isolated microbench over the resolver's representative specifier
set, `memchr2` scans ~37% faster than a scalar loop *even on short
inputs* — on aarch64 NEON is baseline (no runtime dispatch) and memchr
has an optimized small-input path.
All 315 tests pass (`--all-features`); clippy clean. Behaviour is
identical — the no-`?`/`#` case already produced `(Borrowed(specifier),
None, None)`. Latest Branches
+2%
perf/normalize-with-bytes -5%
release-plz-2026-06-18T23-48-37Z +2%
© 2026 CodSpeed Technology