Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress Reporting makes Invoke-RestMethod 70x slower #2238

Closed
afscrome opened this issue Sep 12, 2016 · 4 comments
Closed

Progress Reporting makes Invoke-RestMethod 70x slower #2238

afscrome opened this issue Sep 12, 2016 · 4 comments
Labels
Resolution-Duplicate The issue is a duplicate. WG-Engine-Performance core PowerShell engine, interpreter, and runtime performance WG-Interactive-Console the console experience

Comments

@afscrome
Copy link

Steps to reproduce

#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

Expected behavior

I'd expect progress reporting to have a small overhead, but not a significant one

Actual behavior

$ProgressPreference = 'Continue' is about 70 times slower than 'SilentlyContinue'. (On PS 5.1 in the latest Win 10 preview it is about 120x slower)

TotalSeconds
------------
    8.471039
  589.319871

Environment data

> $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
@nightroman
Copy link

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

@lzybkr lzybkr added WG-Interactive-Console the console experience WG-Engine-Performance core PowerShell engine, interpreter, and runtime performance labels Sep 12, 2016
@oising
Copy link
Contributor

oising commented Sep 12, 2016

@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.

@andyleejordan
Copy link
Member

I'm surprised that it is faster in PS 6 than in PS 5.1. Wow.

@SteveL-MSFT SteveL-MSFT added the Resolution-Duplicate The issue is a duplicate. label Oct 16, 2016
@SteveL-MSFT
Copy link
Member

This is dupe of #2138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate The issue is a duplicate. WG-Engine-Performance core PowerShell engine, interpreter, and runtime performance WG-Interactive-Console the console experience
Projects
None yet
Development

No branches or pull requests

6 participants