[Semi-OT] Fibers vs. Async / Await

rikki cattermole rikki at cattermole.co.nz
Thu May 12 11:48:05 UTC 2022


On 12/05/2022 11:37 PM, René Zwanenburg wrote:
> On Wednesday, 11 May 2022 at 13:49:28 UTC, rikki cattermole wrote:
>> 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.
> 
> That's a good point. As an improvement, could we mark the unused part of 
> the fiber's stack as NO_SCAN when it yields? And ofc undo it when the 
> fiber switches back in. Or would that be too heavy an operation?

I don't think it would help, and could potentially do the wrong thing.

GC's like all memory allocators like to work with blocks of memory, that 
could easily overshoot the bounds of unused that were specified.


More information about the Digitalmars-d mailing list