From e14862b1ce7666c35172cd0231102d4364f0746c Mon Sep 17 00:00:00 2001 From: Richard Kuhnt Date: Mon, 27 Feb 2023 17:55:16 +0100 Subject: [PATCH 1/2] perf(decompress): disable progress bar to improve Expand-Archive performance See: https://github.com/ScoopInstaller/Install/pull/42 --- CHANGELOG.md | 1 + lib/decompress.ps1 | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d856f9e18..e83a77f951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Bug Fixes +- **decompress:** Disable progress bar to improve `Expand-Archive` performance ([#5410](https://github.com/ScoopInstaller/Scoop/issues/5410)) - **decompress:** Exclude '*.nsis' that may cause error ([#5294](https://github.com/ScoopInstaller/Scoop/issues/5294)) - **autoupdate:** Fix file hash extraction ([#5295](https://github.com/ScoopInstaller/Scoop/issues/5295)) - **getopt:** Stop split arguments in `getopt()` and ensure array by explicit arguments type ([#5326](https://github.com/ScoopInstaller/Scoop/issues/5326)) diff --git a/lib/decompress.ps1 b/lib/decompress.ps1 index 785421c1a5..bdee90d620 100644 --- a/lib/decompress.ps1 +++ b/lib/decompress.ps1 @@ -241,8 +241,14 @@ function Expand-ZipArchive { $OriDestinationPath = $DestinationPath $DestinationPath = "$DestinationPath\_tmp" } + # Disable progress bar to gain performance + $oldProgressPreference = $ProgressPreference + $global:ProgressPreference = 'SilentlyContinue' + # Compatible with Pscx v3 (https://github.com/Pscx/Pscx) ('Microsoft.PowerShell.Archive' is not needed for Pscx v4) Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force + + $global:ProgressPreference = $oldProgressPreference if ($ExtractDir) { movedir "$DestinationPath\$ExtractDir" $OriDestinationPath | Out-Null Remove-Item $DestinationPath -Recurse -Force From 72e46704d7f4893cecbc893f19d61653023310b0 Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Tue, 28 Feb 2023 01:15:51 +0800 Subject: [PATCH 2/2] Update chglog [skip ci] --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e83a77f951..d7089a089b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ ### Bug Fixes -- **decompress:** Disable progress bar to improve `Expand-Archive` performance ([#5410](https://github.com/ScoopInstaller/Scoop/issues/5410)) - **decompress:** Exclude '*.nsis' that may cause error ([#5294](https://github.com/ScoopInstaller/Scoop/issues/5294)) - **autoupdate:** Fix file hash extraction ([#5295](https://github.com/ScoopInstaller/Scoop/issues/5295)) - **getopt:** Stop split arguments in `getopt()` and ensure array by explicit arguments type ([#5326](https://github.com/ScoopInstaller/Scoop/issues/5326)) @@ -18,6 +17,10 @@ - **install:** Fix download from private GitHub repositories ([#5361](https://github.com/ScoopInstaller/Scoop/issues/5361)) - **scoop-info:** Fix errors in file size collection when `--verbose` ([#5352](https://github.com/ScoopInstaller/Scoop/pull/5352)) +### Performance Improvements + +- **decompress:** Disable progress bar to improve `Expand-Archive` performance ([#5410](https://github.com/ScoopInstaller/Scoop/issues/5410)) + ### Code Refactoring - **git:** Use Invoke-Git() with direct path to git.exe to prevent spawning shim subprocesses ([#5122](https://github.com/ScoopInstaller/Scoop/issues/5122), [#5375](https://github.com/ScoopInstaller/Scoop/issues/5375))