The following example code should accelerate the execution of a Raku program:
for (1..4).race() {
say "Doing $_";
sleep 1;
}
say now - INIT now;
I remember, that it worked some time ago, but now I always end up with 4 seconds runtime. Also using .race() or adding parameters doesn't change anything. What does I have to do, to run 2 processes at the same time?
You should use race
with the named argument batch
and the statement prefix race
.
say race for (1..4).race(batch=>1) {
say "Doing $_";
sleep 1.rand;$_
}
say now - INIT now;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With