Microsoft.PowerShell.Archive icon indicating copy to clipboard operation
Microsoft.PowerShell.Archive copied to clipboard

Compress-Archive is slow on 6.2.1 and 6.2.2

Open allanoro opened this issue 5 years ago • 5 comments

When I attempt to use 'Compress-Archive' on any folder with lots of items of varying sizes in PS 6.2.0 and the process will be rather quick. Attempt the same process on the same selection of files on PS 6.2.1 or 6.2.2 and the process takes a much longer time.

I've had to roll back to 6.2.0 on my desktop, but on a Win2012R2 server where I have tested 6.2.0, 6.2.1, and 6.2.2, the environment details are below for 6.2.1:

Originally reported in powershell/powershell#10264

Name Value

PSVersion 6.2.1 PSEdition Core GitCommitId 6.2.1 OS Microsoft Windows 6.3.9600 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0.} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

allanoro avatar Jul 31 '19 07:07 allanoro

I'm seeing the same in 6.2.3, trying to compress 1.5k files, 620 folders of 50mb size (python source for lambda deployment. Sometimes it's quick, other times I'm waiting 5 minutes. For comparison 7z took 15 seconds. I'm using compress-archive in conjuction with Update-LMFunctionCode as part of a deploy script.

brendan-sherrin avatar Jan 28 '20 03:01 brendan-sherrin

This appears to be an issue still in PS7. Incredibly slow performance.

Name Value


PSVersion 7.0.0 PSEdition Core GitCommitId 7.0.0 OS Microsoft Windows 10.0.17763 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

allanoro avatar Mar 05 '20 00:03 allanoro

For me, an additional aspect of this issue is between having an asterisk in -Path or not. As described in the doc, the asterisk makes the zip file not have a directory as the top/root, but rather the files that were inside.

For tests, I downloaded just a Python boto3 package (because that's what I was originally having issues with, so I know it will reproduce).

mkdir compresstest
pip install --target=./compresstest boto3

Then I ran four tests: in PS 5.1 and PS 7.1, with and without the asterisk. I actually ran them a number of times and the results were consistent.

PS Ver No Asterisk With Asterisk
PS 5.1 24s 28s
PS 7.1 4s 64s

(The test commands were variations on measure-command {compress-archive .\compresstest\* -DestinationPath .\compresstest-ps7-1.zip -Force})

All four resulting zips are roughly the same size and contents, besides the presence or absence of a top-level folder within the zip.

ghost avatar Nov 14 '20 03:11 ghost

I am labeling this as an enhancement for the next Microsoft.PowerShell.Archive release(s).

ayousuf23 avatar Jun 03 '22 16:06 ayousuf23

More than 4 years since this issue was opened. It's still slow as heck.

nirinsanity avatar Nov 02 '23 15:11 nirinsanity