[Semi-OT] Fibers vs. Async / Await
Steven Schveighoffer
schveiguy at gmail.com
Thu May 12 12:57:15 UTC 2022
On 5/12/22 7:37 AM, 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?
Fibers already do this.
https://github.com/dlang/druntime/blob/392c528924d0ce4db57a03bfdaa6587169568493/src/core/thread/fiber.d#L429-L436
-Steve
More information about the Digitalmars-d
mailing list