diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-19 09:39:24 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-19 09:39:24 +0900 |
| commit | f09578e81a1699f2f825e19705adebfdc4da249e (patch) | |
| tree | 3f93a5ecdc7aef89db6b1ebd53f3d9814bbff1c5 /crates/shirabe/src/command/run_script_command.rs | |
| parent | 1d2d1a47f6b1cc98b82d5dc8a0574b13593dbb60 (diff) | |
| download | php-shirabe-f09578e81a1699f2f825e19705adebfdc4da249e.tar.gz php-shirabe-f09578e81a1699f2f825e19705adebfdc4da249e.tar.zst php-shirabe-f09578e81a1699f2f825e19705adebfdc4da249e.zip | |
perf(curl-downloader): reuse one reqwest client per tokio runtime
CurlDownloader built a fresh reqwest Client, and with it a fresh
connection pool, on every construction. A `require` run constructs two:
RequireCommand::doUpdate discards the Composer instance that
BaseCommand::initialize built and rebuilds it against the rewritten
composer.json, so the second one opened a second TCP+TLS connection to
the same repository and paid another CA bundle parse.
Nothing in the constructor varies the Client -- `options` and
`disable_tls` are not applied to it -- so it can be shared. The cache is
keyed by tokio runtime rather than by process: a pooled connection is
driven by a task on the runtime that opened it and hangs if it is later
handed to another one, and `sync_executor::block_on` builds a disposable
runtime per call outside `main`.
Measured on `require monolog/monolog` in a git-managed project against a
warm cache: TLS connections to the repository drop from 2 to 1, taking
the run from 646 ms to 529 ms with the network and from 104 ms to 101 ms
offline.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/command/run_script_command.rs')
0 files changed, 0 insertions, 0 deletions
