[Semi-OT] Fibers vs. Async / Await

IGotD- nise at nise.com
Thu May 12 09:16:37 UTC 2022


On Thursday, 12 May 2022 at 08:49:18 UTC, Sebastiaan Koppe wrote:
>
> Don't forget that fibers aren't supported on all platforms.
>
> They are definitely interesting but I don't think they should 
> be the basis of everything.

That was one of my observations when I looked in the druntime 
source code. The D runtime has basically implemented all of the 
scheduling itself, including all context switching. This means 
that it has to be implemented for all architectures, and variants 
of all architectures which is a lot. Many platforms like Windows 
has its own fiber API and I was surprised that druntime didn't 
use that one.

I'm not saying that it is wrong to do the entire implementation 
in druntime but it is a lot of work and only the most common CPU 
architectures will be supported. There is also the risk that it 
becomes outdated as CPU vendors add stuff to their CPUs.

I think since the D project has such limited resources, it should 
go for as generic solutions and reuse existing APIs. Async/Await 
is becoming accepted as a programming model and I think that D 
should put its effort to support that.


More information about the Digitalmars-d mailing list