On 11-05-25 05:14 PM, Rafael Ávila de Espíndola wrote:
I'm assuming this yield flag is primarily for timeouts, correct? What
other ways are there to set the yield flag?

I was reading some about Erlang today and it looks like they way they
handle timeouts is to let each program run for a certain number of
"reductions." If we wanted to fix the timeslice at compile time, we
could use a similar approach. We could simply insert yields every N
instructions, and for loops we could say "this loop body is 15
instructions, so we need to make sure to yield every N/15 iterations."
It seems like this would make the "yield flag" mostly unnecessary.

Remember that we are producing LLVM and that LLVM has no idea what a
call to yield is.

Yeah. This sort of thing doesn't tend to work great anyways; trying to calibrate instruction counts to time is mostly impossible at a distance, and the extra machinery in the loop winds up costing just as much as polling a flag.

I'm willing to handle unsafe loops and/or fixed-iteration-count (guaranteed not to diverge) loops explicitly in the language, if this is a concern. Even add an optimization pass that tries to sniff out fixed iteration counts and convert loop types / eliminate checks.

In practice I just don't think we have reason to believe this is a performance killer. It hasn't been where it's done elsewhere.

-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to