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
}
}
I'm not a Windows expert but maybe compare your script with this one by ADJA http://webcache.googleusercontent.com/search?q=cache:N2VFVE2MDGIJ:www.algos.school/stress-testing+&cd=1&hl=en&ct=clnk&gl=pl
(cache link because the original one is dead)
I brought the website down just yesterday, lol, because my free Google Cloud credit was expiring and I wasn't updating content anymore.
That said, there are several outdated things in the scripts in the article. Lately, when writing stress tests, I don't pass random seed to the generator, and simply use this function to generate random stuff:
Source
Thanks Errichto for sharing the link to that awesome blog. And Thanks ADJA for creating that blog post. It is very much informative.
I've got where the problem is in my script. I'm compiling three files again and again, where I had to compile just one time and use executable files repetitively. But I don't know how to do that :). Anyway, using a batch file is also awesome.
Thanks again :D