Performance issue with fiber

hanabi1224 harlowmoo at gmail.com
Wed Jul 28 21:39:33 UTC 2021


On Wednesday, 28 July 2021 at 16:26:49 UTC, drug wrote:
> I profiled the provided example (not `FiberScheduler`) using 
> perf. Both dmd and ldc2 gave the same result - `void 
> filterInner(int, int)` took ~90% of the run time. The time was 
> divided between:
> 	`int std.concurrency.receiveOnly!(int).receiveOnly()` - 58%
> 	`void std.concurrency.send!(int).send(std.concurrency.Tid, 
> int)` - 31%
>
> So most of the time is messages passing.
>
> Between the fibers creating took very few time. Perf output 
> contains information only of `void 
> std.concurrency.FiberScheduler.create(void delegate()).wrap()` 
> which took less than 0.5%. But I wouldn't say that I did the 
> profiling ideally so take it with a grain of salt.

Very interesting findings! After making the Fiber fix, I also 
made profiling with valgrind, the result shows MessageBox related 
staff contributes to ~13.7% of total cycles, swapContex related 
staff add up to a larger percentage (My rough estimation is 
 >50%), I'd like to share the result svg but did not figure out 
how to upload here.


More information about the Digitalmars-d-learn mailing list