Skip to content

Conversation

@iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Nov 7, 2016

Add timer to update a progress pane every 200 ms.

(After we get the timer it will be possible to solve the "hung" state problem in following PR)

Close #2138

Add timer to update a progress pane every 200 ms
@msftclas
Copy link

msftclas commented Nov 7, 2016

Hi @iSazonov, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@SteveL-MSFT
Copy link
Member

@iSazonov do you have any perf data particularly with invoke-webrequest?

@iSazonov
Copy link
Collaborator Author

iSazonov commented Nov 8, 2016

@SteveL-MSFT
Before patch:

Measure-Command { Invoke-WebRequest "https://github.com/dotnet/corefx/archive/master.zip" -OutFi
le "C:\tmp\master.zip" }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 49
Milliseconds      : 741
Ticks             : 497419183
TotalDays         : 0.000575716646990741
TotalHours        : 0.0138171995277778
TotalMinutes      : 0.829031971666667
TotalSeconds      : 49.7419183
TotalMilliseconds : 49741.9183

Measure-Command { $wc = New-Object System.Net.WebClient; $wc.DownloadFile("https://github.com/do
tnet/corefx/archive/master.zip", "C:\tmp\master.zip") }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 20
Milliseconds      : 154
Ticks             : 201545506
TotalDays         : 0.000233270261574074
TotalHours        : 0.00559848627777778
TotalMinutes      : 0.335909176666667
TotalSeconds      : 20.1545506
TotalMilliseconds : 20154.5506

After patch:

Measure-
Command { Invoke-WebRequest "https://github.com/dotnet/corefx/archive/master.zip" -OutFile "C:\tmp\master.zip" }


Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 19
Milliseconds      : 320
Ticks             : 193203890
TotalDays         : 0.000223615613425926
TotalHours        : 0.00536677472222222
TotalMinutes      : 0.322006483333333
TotalSeconds      : 19.320389
TotalMilliseconds : 19320.389

@lzybkr lzybkr merged commit 760a9c2 into PowerShell:master Nov 8, 2016
@iSazonov iSazonov deleted the writeprogresstimer branch November 10, 2016 05:28
daxian-dbw added a commit to daxian-dbw/PowerShell that referenced this pull request Nov 29, 2016
mirichmo pushed a commit that referenced this pull request Nov 30, 2016
iSazonov added a commit to iSazonov/PowerShell that referenced this pull request Dec 19, 2016
1. All updates left in one thread. (The use of multiple threads was the
main problem previous PR PowerShell#2640)

2. The timer is only used to set up a update flag. (According to my
tests calling Datetime.Now() and verifing the time delta creates a much
larger delay)

3. The timer interval is 200 ms. I test intervals from 50 ms to 2000 ms.
I don't see any differences on the screen with 100 ms and 200 ms. So I
chose the more cost-effective option. What do you think about this?

4. Removed unnecessary locking. `WriteProgress` is executed as quickly
as possible, as a result the entire script executes significantly faster
Sekers added a commit to Sekers/SKYAPI that referenced this pull request Nov 6, 2024
… or Invoke-RestMethod.

This improves performance due to a bug in some versions of PowerShell. It was eventually fixed in Core (v6.0.0-alpha.13) but still is around in Desktop.

More Information: PowerShell/PowerShell#2640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants