aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/installer/metapackage_installer_test.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-18 18:41:40 +0900
committernsfisis <nsfisis@gmail.com>2026-07-18 18:41:40 +0900
commit8cf9f977d90d0a8e8bfcb868a7ebcd4e1309c517 (patch)
tree6856e67a3216f227651889c083cfa8f23170f026 /crates/shirabe/tests/installer/metapackage_installer_test.rs
parent307e66847dd5e00ad1890b6a64d3ac7192a03efc (diff)
downloadphp-shirabe-8cf9f977d90d0a8e8bfcb868a7ebcd4e1309c517.tar.gz
php-shirabe-8cf9f977d90d0a8e8bfcb868a7ebcd4e1309c517.tar.zst
php-shirabe-8cf9f977d90d0a8e8bfcb868a7ebcd4e1309c517.zip
perf(installation-manager): run executeBatch operation chains concurrently
executeBatch now builds one future per operation — the PHP promise chain prepare -> install/update/uninstall -> cleanup -> repo->write, including the '<Op> of <pkg> failed' rejection handler covering the chain up to cleanup — and drives the whole batch through waitOnPromises()/Loop::wait, so archive extraction (the unzip subprocesses gated by ProcessExecutor's semaphore) finally overlaps across packages. Alias operations stay synchronous in the collection loop like PHP. The shared repository is threaded through the chains as RefCell<&mut dyn InstalledRepositoryInterface>: execute() wraps the incoming &mut once, and InstallerInterface::install/update/uninstall take the cell so implementations borrow it only in their synchronous head/tail, never across an await. InstallationManager's own install/update/uninstall/download/get_installer/get_install_path/ mark_for_notification move to &self (cache and notifiable_packages behind RefCell) so every chain can capture &self. WritableRepositoryInterface::write and the InstallationManagerInterface get_install_path it relies on lose their &mut manager requirement — the per-op repo->write inside the chains only reads install paths. Warm-cache create-project laravel/laravel: the package-operations phase (109 installs) drops from ~3.0-3.8s serial to ~1.9s, on par with real Composer (~2.1s) measured back-to-back; the resulting vendor tree, installed.json included, stays byte-identical to Composer's (diff -rq clean). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/installer/metapackage_installer_test.rs')
-rw-r--r--crates/shirabe/tests/installer/metapackage_installer_test.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/tests/installer/metapackage_installer_test.rs b/crates/shirabe/tests/installer/metapackage_installer_test.rs
index 3c1f0efe..a3806ec8 100644
--- a/crates/shirabe/tests/installer/metapackage_installer_test.rs
+++ b/crates/shirabe/tests/installer/metapackage_installer_test.rs
@@ -22,7 +22,7 @@ fn test_install() {
let installer = installer();
let mut repository = InstalledArrayRepository::new_with_packages(vec![]).unwrap();
- run(installer.install(&mut repository, package.clone())).unwrap();
+ run(installer.install(&std::cell::RefCell::new(&mut repository as &mut dyn shirabe::repository::InstalledRepositoryInterface), package.clone())).unwrap();
assert!(repository.has_package(package));
}
@@ -35,13 +35,13 @@ fn test_update() {
let mut repository =
InstalledArrayRepository::new_with_packages(vec![initial.clone()]).unwrap();
- run(installer.update(&mut repository, initial.clone(), target.clone())).unwrap();
+ run(installer.update(&std::cell::RefCell::new(&mut repository as &mut dyn shirabe::repository::InstalledRepositoryInterface), initial.clone(), target.clone())).unwrap();
assert!(!repository.has_package(initial.clone()));
assert!(repository.has_package(target.clone()));
// Updating again, with the initial package no longer installed, fails.
- assert!(run(installer.update(&mut repository, initial, target)).is_err());
+ assert!(run(installer.update(&std::cell::RefCell::new(&mut repository as &mut dyn shirabe::repository::InstalledRepositoryInterface), initial, target)).is_err());
}
#[test]
@@ -51,10 +51,10 @@ fn test_uninstall() {
let mut repository =
InstalledArrayRepository::new_with_packages(vec![package.clone()]).unwrap();
- run(installer.uninstall(&mut repository, package.clone())).unwrap();
+ run(installer.uninstall(&std::cell::RefCell::new(&mut repository as &mut dyn shirabe::repository::InstalledRepositoryInterface), package.clone())).unwrap();
assert!(!repository.has_package(package.clone()));
// Uninstalling again, with the package no longer installed, fails.
- assert!(run(installer.uninstall(&mut repository, package)).is_err());
+ assert!(run(installer.uninstall(&std::cell::RefCell::new(&mut repository as &mut dyn shirabe::repository::InstalledRepositoryInterface), package)).is_err());
}