aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/package/locker.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-20 01:54:09 +0900
committernsfisis <nsfisis@gmail.com>2026-08-20 02:49:30 +0900
commit80c2120a64ce9b989da288ce1fcf80dec5cf38c1 (patch)
treedca0844c4d037db685591e5dacc04fbd11263fb2 /crates/shirabe/src/package/locker.rs
parentad335434e5376d29f38882d0dceb2461bfd8d5c6 (diff)
downloadphp-shirabe-80c2120a64ce9b989da288ce1fcf80dec5cf38c1.tar.gz
php-shirabe-80c2120a64ce9b989da288ce1fcf80dec5cf38c1.tar.zst
php-shirabe-80c2120a64ce9b989da288ce1fcf80dec5cf38c1.zip
perf(semver): build CompilingMatcher's cache key without allocating
CompilingMatcher::match formats `<operator><constraint>;<version>` into a fresh String on every call, including the cache hits the key exists to serve. Profiling put the formatting at 2.9 % of self time, more than the match it guards. Build the key into a reused thread-local buffer and copy it only when there is a miss to record. Taking the version as `&str` rather than `String` removes the copy the callers made for the same reason: `optimize_by_identical_dependencies` allocated one per candidate package in its innermost loop. laravel/framework require --no-install (warm cache, network disabled): instructions:u 9142799608 -> 8895247586 (-2.7 %) cycles:u 4626440169 -> 4496152041 (-2.8 %) wall (hyperfine, 25 runs) 1.239 s +- 0.014 s -> 1.227 s +- 0.016 s (-1.0 %) monolog/monolog is unchanged (102.1 ms -> 101.6 ms, within noise). composer.lock is byte-identical for both packages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package/locker.rs')
0 files changed, 0 insertions, 0 deletions