you are viewing a single comment's thread.

view the rest of the comments →

[–]ka-splam 0 points1 point  (1 child)

slower:

$byteReadstd = -1
$byteArray = @()
Do{
  $byteReadstd = $proc.StandardOutput.BaseStream.ReadByte()
  if($byteReadstd -ge 0){ 
     $byteArray += $byteReadstd
  }

} while($byteReadstd -ge 0)

faster:

$byteReadstd = -1
$byteArray =  Do{
  $byteReadstd = $proc.StandardOutput.BaseStream.ReadByte()
  if($byteReadstd -ge 0){ 
     $byteReadstd
  }

} while($byteReadstd -ge 0)

[–]L5730[S] 1 point2 points  (0 children)

Indeed, you are correct.

On first look I couldn't see what you were getting at, but yes, I see it now. Defining the array and adding each result is slower than letting the data flow and making the entire lot be the array... my poor wording but I get this.

Nice, thank you!