From f58f79ee30e16d5ef45553982b164904a99fb73f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 20 Aug 2026 01:22:45 +0900 Subject: perf(repository): take ownership of the decoded provider JSON startCachedAsyncDownload's cached branch decoded the provider JSON into an owned value and then rebuilt it entry by entry, recursively cloning every package definition only to drop the original. Match the decoded value by value instead. PHP hands the decoded array to the closure by COW, so no copy happens there either. laravel/framework require --no-install (warm cache, network disabled): instructions:u 10276126917 -> 9884102191 (-3.8 %) cycles:u 5048262624 -> 4777881212 (-5.4 %) wall (hyperfine, 20 runs) 1.345 s +- 0.015 s -> 1.316 s +- 0.018 s (-2.2 %) monolog/monolog is unchanged (100.7 ms -> 101.7 ms, within noise). composer.lock is byte-identical for both packages. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/bench/require.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'scripts/bench') diff --git a/scripts/bench/require.sh b/scripts/bench/require.sh index 0322f24f..153e7afe 100755 --- a/scripts/bench/require.sh +++ b/scripts/bench/require.sh @@ -34,10 +34,14 @@ PACKAGE_SLUG="${PACKAGE//\//-}" PREPARE_SCRIPT="$OUTDIR/prepare.sh" cat > "$PREPARE_SCRIPT" < '$TARGET_DIR-shirabe/composer.json' -printf '{"name": "shirabe-bench/require-test"}' > '$TARGET_DIR-composer/composer.json' +for dir in '$TARGET_DIR-shirabe' '$TARGET_DIR-composer'; do + rm -rf "\$dir" + mkdir -p "\$dir" + git -C "\$dir" init . + git -C "\$dir" config user.name 'John Doe' && git config user.email john@example.com + git -C "\$dir" commit --allow-empty -m init + printf '{"name": "shirabe-bench/require-test"}' > "\$dir/composer.json" +done EOF hyperfine \ @@ -45,7 +49,6 @@ hyperfine \ --prepare "bash '$PREPARE_SCRIPT'" \ --export-json "$OUTDIR/results-$PACKAGE_SLUG.json" \ --export-markdown "$OUTDIR/results-$PACKAGE_SLUG.md" \ - --ignore-failure \ --command-name Shirabe "RUST_BACKTRACE=1 '$BIN' require --no-install --no-audit --no-interaction --working-dir='$TARGET_DIR-shirabe' '$PACKAGE'" \ --command-name Composer "'$COMPOSER_BIN' require --no-install --no-audit --no-interaction --working-dir='$TARGET_DIR-composer' '$PACKAGE'" -- cgit v1.3.1-4-g156e