PowerShell Performance Series Part 2 (Get-PerformanceHistory.ps1)
Jaykul, made a Get-PerformanceHistory function we also used during the Scripting games but I could find only the CTP2 version in the repository , and to compare V1 to CTP2 we need to be able to run it on both versions, hence I used a quick one-liner to query the history, but Jaykul made an updated version that also works on V1 http://powershellcentral.com/scripts/424 and still has naming, the Average column, formatting linecount -etc
PoSH> Get-PerformanceHistory 7
Duration Average Commmand
-------- ------- --------
5.29700 0.00011 1..50000 | % { dummy }
4.03800 0.00008 1..50000 | % { $obj = 1 }
1.16000 0.00002 for($i = 0; $i -lt 50000;$i++ ) { dummy }
0.12400 0.00000 for($i = 0; $i -lt 50000;$i++ ) { $obj = 1 }
1.52900 0.00003 1..50000 | &{ process {dummy} }
0.00000 0.00000 function k% ([scriptblock]$sb){process {&$sb }}
9.32100 0.00019 1..50000 | K% { dummy }
For the CTP2 version see : http://powershellcentral.com/scripts/155
This function is very handy, it also uses get-history we do not need to rerun a command to time it, and the processing has no effect on the testing as processing is afterwards, using data available anyway, so we are able to use it anytime without preparements , so for future tests I'm going to use this function.
enjoy,
Greetings /\/\o\/\/