Skip to content

Beta.9 - Invoke-WebRequest speed seems slow compare to Windows version but is not. #5284

Closed

Description

Compare execution of downloading a file using Invoke-WebRequest in both Windows PowerShell and PowerShell Core Beta.9. Beta.9 seems slower than Windows but is not. The progress bar in PowerShell Core is refreshing slower but in fact the process runs faster in Beta.9.

Steps to reproduce

Execute following command below in both Windows and PowerShell Beta.9:

Measure-Command {Invoke-WebRequest -Uri "https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-beta.9/PowerShell-6.0.0-beta.9-win-x86.msi" -OutFile C:\Users\max_t\Downloads\PowerShell-6.0.0-beta.9-win-x86.msi}

Expected behavior

Visually seems processing speed should be the same if executing the command on the same system.

Actual behavior

PowerShell Core Beta,9 progress bar refresh is a bit slower then Windows PowerShell.
But, the end results is that PowerShell Core Beta.9 runs a bit faster than Windows PowerShell.

## - Windows PowerShell 5.1 resutls:
PS C:\Users\max_t> Measure-Command {Invoke-WebRequest -Uri "https://github.com/PowerShell/PowerShell/releases/download/v
6.0.0-beta.9/PowerShell-6.0.0-beta.9-win-x86.msi" -OutFile C:\Users\max_t\Downloads\PowerShell-6.0.0-beta.9-win-x86.msi}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 34
Milliseconds      : 777
Ticks             : 347771486
TotalDays         : 0.000402513293981481
TotalHours        : 0.00966031905555556
TotalMinutes      : 0.579619143333333
TotalSeconds      : 34.7771486
TotalMilliseconds : 34777.1486

## - PowerShell Core Beta.9 results:
PS C:\Program Files\PowerShell\6.0.0-beta.9> Measure-Command {Invoke-WebRequest -Uri "https://github.com/PowerShell/PowerShell/releases/download/v
6.0.0-beta.9/PowerShell-6.0.0-beta.9-win-x86.msi" -OutFile C:\Users\max_t\Downloads\PowerShell-6.0.0-beta.9-win-x86.msi}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 7
Milliseconds      : 942
Ticks             : 79426444
TotalDays         : 9.19287546296296E-05
TotalHours        : 0.00220629011111111
TotalMinutes      : 0.132377406666667
TotalSeconds      : 7.9426444
TotalMilliseconds : 7942.6444

Environment data

PS C:\Program Files\PowerShell\6.0.0-beta.9> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta.9
PSEdition                      Core
GitCommitId                    v6.0.0-beta.9
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\Users\max_t> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.15
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.15
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

webrequest_05_2017-11-01_0-54-18

webrequest_04_2017-11-01_0-54-18

Activity

  1. MaximoTrinidad commented on Oct 31, 2017

    @MaximoTrinidad
    Author

    Seems like it's OK, but this one could be address in UserVoice for Windows PowerShell. Seems like a low priority the more I look at this one.

    At least is posted.
    :)

    Let know that you think.

    Thanks!

  2. SteveL-MSFT commented on Oct 31, 2017

    @SteveL-MSFT
    Member

    Progress bar updates on PSCore6 happens less frequently and is by-design to improve cmdlet performance. In Windows PowerShell, the progress bar was updated pretty much all the time and this had a significant impact on cmdlets (not just the web cmdlets but any that updated progress). With PSCore6, we have a timer to only update the progress bar every 200ms on a single thread so that the CPU spends more time in the cmdlet and less time updating the screen. This was #2822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions