[Semi-OT] Fibers vs. Async / Await

rikki cattermole rikki at cattermole.co.nz
Wed May 11 13:49:28 UTC 2022


On 12/05/2022 1:27 AM, René Zwanenburg wrote:
> All the above problems don't exist when using fibers. The only downside 
> of fibers I'm aware of is that you have a full stack allocated for every 
> fiber. This can cost a lot of (virtual) memory, but on the other hand it 
> makes for very effective pooling. And if you're in a situation where 
> this really is a problem you can tweak the stack size. Seems like a 
> small price to pay to me.

Don't forget the extra cost of having to scan those stacks regardless of 
those fibers state.

The context state required for a task will be a lot smaller (and hence 
cheaper) than what a single fiber stack will cost to scan.


More information about the Digitalmars-d mailing list