Performance issue with fiber

Stefan Koch uplink.coder at gmail.com
Sat Jul 24 09:17:47 UTC 2021


On Wednesday, 21 July 2021 at 22:51:38 UTC, hanabi1224 wrote:
> Hi, I'm new to D lang and encounter some performance issues 
> with fiber, not sure if there's something obviously wrong with 
> my code.
>
>
There is your problem.
>     auto scheduler = new FiberScheduler;

The Fiber scheduler will spawn a new fiber for every job.
It will not use a fiber pool. Spawning a new fiber is expensive 
because of the stack allocation for it.
Also if I recall correctly it will run single-threaded but I am 
not 100% sure on that.
Just have a look at the running processes ... if you just see one 
than you are single threaded.



More information about the Digitalmars-d-learn mailing list