Faster way to run powershell script

Revision en1, by Naim, 2020-10-15 09:53:41

After watching Errichto's this video on testing solutions I have created a powershell script for that. But when I run my script it runs more than 50 times slower than bash script what Errichto has shown in his video.

My question is, is there any way to improve the runtime of this powershell script? And It would be awesome if others share how they use script for debugging in contest time.

My powershell script:

for ($i = 0; ; $i++) { 
    Write-Output "$i"
    Start-Process .\Generator.exe -RedirectStandardOutput .\in -NoNewWindow -Wait
    Start-Process .\Brute.exe -RedirectStandardInput .\in -RedirectStandardOutput .\out1 -NoNewWindow -Wait
    Start-Process .\Error.exe -RedirectStandardInput .\in -RedirectStandardOutput .\out2 -NoNewWindow -Wait
    if ((Get-FileHash .\out1).Hash -ne (Get-FileHash .\out2).Hash) {
        Compare-Object (Get-Content out1) (Get-Content out2)
        break
    }
}
Tags powershell, script

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Naim 2020-10-15 11:09:24 1
en1 English Naim 2020-10-15 09:53:41 1029 Initial revision (published)