Skip to content

Instantly share code, notes, and snippets.

@ngetchell
Created January 26, 2018 00:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ngetchell/d98d0c3f5140ddff040328900f900b75 to your computer and use it in GitHub Desktop.
Save ngetchell/d98d0c3f5140ddff040328900f900b75 to your computer and use it in GitHub Desktop.
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