Internal and external iteration, fibers

Rob T alanb at ucora.com
Mon Jan 21 12:15:48 PST 2013


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?

By chance, do you know if the current implementation is a 
built-in language feature or if it's implemented entirely as a 
library?

--rt


More information about the Digitalmars-d mailing list