Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get-Job | Remove-Job -Force
$Job = Measure-Command { 1..10 | ForEach-Object {
Start-Job -ArgumentList $_ -ScriptBlock {
Param($Arg)
$arg % 2
}
}
Get-Job | Receive-Job -Wait
}
$Thread = Measure-Command { 1..10 | ForEach-Object {
Start-ThreadJob -ArgumentList $_ -ScriptBlock {
Param($Arg)
$arg % 2
}
}
Get-Job | Receive-Job -Wait
}
"Job Milliseconds: {0}" -f $Job.TotalMilliseconds
"Thread Milliseconds: {0}" -f $Thread.TotalMilliseconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment