Performance issue with fiber

hanabi1224 harlowmoo at gmail.com
Wed Jul 28 21:15:59 UTC 2021


On Wednesday, 28 July 2021 at 16:31:49 UTC, Ali Çehreli wrote:
> I assume the opposite because normally, the number of times a 
> thread or fiber is spawned is nothing compared to the number of 
> times they are context-switched. So, spawning can be expensive 
> and nobody would realize as long as switching is cheap.

You are right, but that's not my point. whether fiber spawning is 
expensive should be compared to thread, and it should be much 
less expensive, ppl can expect to create much more fibers at the 
same time than system thread, even if it's stackful (that should 
mostly contribute to heap memory usage, fiber stack size should 
not be a perf bottleneck before running out of mem). And when 
analyzing perf issues with fiber, it's not a valid reason to me 
that 'fiber is expensive' because fiber itself is the solution to 
the expensiveness of thread, and non of the other fiber 
implementations in other languages/runtime have the same issue 
with the same test case.



More information about the Digitalmars-d-learn mailing list