#Run with progress reporting disabled
$ProgressPreference = 'SilentlyContinue'
Measure-Command {
Invoke-RestMethod https://archive.apache.org/dist/lucene/solr/6.2.0/solr-6.2.0.zip -OutFile 2.zip
} | select TotalSeconds
#Now run with the default Progress Preference value
$ProgressPreference = 'Continue'
Measure-Command {
Invoke-RestMethod https://archive.apache.org/dist/lucene/solr/6.2.0/solr-6.2.0.zip -OutFile 1.zip
} | select TotalSeconds
I'd expect progress reporting to have a small overhead, but not a significant one
$ProgressPreference = 'Continue' is about 70 times slower than 'SilentlyContinue'. (On PS 5.1 in the latest Win 10 preview it is about 120x slower)
------------
8.471039
589.319871
> $PSVersionTable
Name Value
---- -----
SerializationVersion 1.1.0.1
PSEdition Core
PSVersion 6.0.0-alpha
WSManStackVersion 3.0
BuildVersion 3.0.0.0
GitCommitId v6.0.0-alpha.9
PSRemotingProtocolVersion 2.3
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
CLRVersion
It is a proper issue. But the real culprit here is probably the implementation of console host WriteProgress(). It can be improved for all cmdlets, including Invoke-RestMethod.
https://connect.microsoft.com/PowerShell/feedback/details/337323
@nightroman I get the point of that connect item, but it seems to be putting the onus on powershell to ignore too many calls to WriteProgress instead of - imo rightfully - blaming the caller for making too many calls :) That said, the base performance could likely be improved, absolutely.
I'm surprised that it is _faster_ in PS 6 than in PS 5.1. Wow.
This is dupe of https://github.com/PowerShell/PowerShell/issues/2138
Most helpful comment
It is a proper issue. But the real culprit here is probably the implementation of console host
WriteProgress(). It can be improved for all cmdlets, includingInvoke-RestMethod.https://connect.microsoft.com/PowerShell/feedback/details/337323