On Monday, 21 January 2013 at 20:15:49 UTC, Rob T wrote:
On Monday, 21 January 2013 at 08:44:10 UTC, Nick Sabalausky
wrote:
I ask, because if except for the overhead, fibers are a good
general solution, then it makes sense to determine if
anything can be done to lessen the overhead before trying to
implement yet another solution.
Yea, they *would* be a good general solution, and I'm sure the
overhead
can be decreased, but AIUI I don't think it's even
theoretically
possible for them to optimized enough to compete with any of
the other
approaches as a general-purpose thing.
The other stuff can be optimized down as far as being little
more than
an increment per iteration. But AIUI, using a real fiber would
require
two context-switches per iteration, so I'm not sure that can
ever
compete.
I have not yet had time to actually use fibers for anything
real, but I did play around with them and the usage seemed to
be exactly what we're looking for to implement co-routines.
Since you have experience using them for real, do you think
they are useful in general assuming that the performance can be
made par with the stackless select switch method?
It has no chance to be as fast. However, I use them quite a lot
and they are very useful. Especially to hide IO latency or for
dependancy management. I use them for the latter, some other
software (like vide.d) use them for the former.
This cannot be achieved with stackless coroutine method as you
need to yield from anywhere, not only the root function.
By chance, do you know if the current implementation is a
built-in language feature or if it's implemented entirely as a
library?
This is done as library right now, which is awesome !