Strange slow piping to out-gridview

Hello

I’ve got a strange behavior:
newly installed Windows 7 SP1
upgraded PowerShell to 4.0


Measure-Command {
1…10
}

Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 6
Ticks : 68685
TotalDays : 7,94965277777778E-08
TotalHours : 1,90791666666667E-06
TotalMinutes : 0,000114475
TotalSeconds : 0,0068685
TotalMilliseconds : 6,8685


Measure-Command {
Out-GridView
}

Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 1
Ticks : 17251
TotalDays : 1,99664351851852E-08
TotalHours : 4,79194444444444E-07
TotalMinutes : 2,87516666666667E-05
TotalSeconds : 0,0017251
TotalMilliseconds : 1,7251

BUT:

Measure-Command {
1…10 | Out-GridView
}

Days : 0
Hours : 0
Minutes : 0
Seconds : 30
Milliseconds : 377
Ticks : 303771673
TotalDays : 0,000351587584490741
TotalHours : 0,00843810202777778
TotalMinutes : 0,506286121666667
TotalSeconds : 30,3771673
TotalMilliseconds : 30377,1673

any ideas why piping takes soooo loong?

Weird. That takes less than a second on my Windows 10 box. Not sure what’s going on there with your versions / system.

I ran this test a series of times in succession using Measure-Object, then counted the average number for seconds and milliseconds among all the Measure-Object runs. This was on a Windows 8.1 x64 machine with PS4.0

$Seconds = @()
$Milliseconds = @()
$MaxRuns = 10;

foreach($i in 1..$MaxRuns)
{
    $e = Measure-Command {1..10 | Out-GridView}
    $Seconds += $e.Seconds
    $Milliseconds += $e.Milliseconds
}
Write-Host "Average number of seconds among $MaxRuns runs:  "+ $($Seconds | Measure-Object -Average).Average
Write-Host "Average number of milliseconds among $MaxRuns runs: " +  $($Milliseconds | Measure-Object -Average).Average

My results:
Average number of seconds among 10 runs: + 0
Average number of milliseconds among 10 runs: + 54.1

results on my machine:

Average number of seconds among 10 runs: + 30
Average number of milliseconds among 10 runs: + 329,7

I find myself having the same issue for the last few days. I am Win7 SP1 (x64), but also seeing the same behavior from (some) servers too? Here are my results:

Average number of seconds among 10 runs: + 30
Average number of milliseconds among 10 runs: + 206.2

It is annoying because I use out-gridview constantly. Something definitely changed. Anyone figure out what?

$Names=@()
Get-TraceSource | select Name | foreach {$Names += $_.Name.Trim()} 
Trace-Command -Name $Names -Expression {1..10 | Out-GridView} -PSHost -Option All
 
 
 

My Result:

For me the freeze is happening between these two lines:

DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [Out-GridView]
DEBUG: ParameterBinding Information: 0 : BIND PIPELINE object to parameters: [Out-GridView]

Same issue here - Win7 SP1 (x64). Did anyone find a fix?

Not yet and what is maddening is that it is randomly fast? Like sometimes after a fresh boot they come up quickly once or twice? Very strange.

Added a note about this on uservoice:

https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/12130563-slow-piping-to-out-gridview

If you are experiencing this please go vote for it, so someone looks at it? Just need someone to ask the right question so we can get this resolved.

Thanks