#Foreachs $Iterations = 100000; $IterativeArray = (0..($Iterations-1)) $ForLoopMetric = Measure-Command -Expression { for ($i=0; $i -lt $Iterations; $i++) { $null = $I+1 } } $ForEachLoopMetric = Measure-Command -Expression { foreach ($Item in $IterativeArray) { $null = $Item+1 } } $PipeForeachMetric = Measure-Command -Expression { $IterativeArray | ForEach-Object {$null = $_+1} } $FunctionalForeachMetric = Measure-Command -Expression { $IterativeArray.ForEach{$null = $_+1} }