Re: Performance issue with fiber

2021-07-30 Thread hanabi1224 via Digitalmars-d-learn
On Friday, 30 July 2021 at 14:41:06 UTC, Daniel Kozak wrote: I have rewrite it to be same as dart version Thanks! There're both generator version and fiber version on the site(if possible), the 2 versions are not really comparable to each other (generator solutions should be much faster). The

Re: Performance issue with fiber

2021-07-28 Thread hanabi1224 via Digitalmars-d-learn
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!(in

Re: Performance issue with fiber

2021-07-28 Thread hanabi1224 via Digitalmars-d-learn
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 switchi

Re: Performance issue with fiber

2021-07-28 Thread hanabi1224 via Digitalmars-d-learn
On Wednesday, 28 July 2021 at 14:39:29 UTC, Mathias LANG wrote: Hence doing: ```diff - auto scheduler = new FiberScheduler(); + scheduler = new FiberScheduler(); ``` Thanks for pointing it out! Looks like I was benchmarking thread instead of fiber. I just made the change you suggest but the r

Re: Performance issue with fiber

2021-07-28 Thread hanabi1224 via Digitalmars-d-learn
On Wednesday, 28 July 2021 at 01:12:16 UTC, Denis Feklushkin wrote: Spawning fiber is expensive Sorry but I cannot agree with the logic behind this statement, the whole point of using fiber is that, spwaning system thread is expensive, thus ppl create lightweight thread 'fiber', then if a 'f

Re: Performance issue with fiber

2021-07-26 Thread hanabi1224 via Digitalmars-d-learn
Thank you for your response! I've got some questions tho. On Saturday, 24 July 2021 at 09:17:47 UTC, Stefan Koch wrote: It will not use a fiber pool. Why fiber pool? Isn't fiber a lightweight logical thread which is already implemented with thread pool internally? Spawning a new fiber is e

Performance issue with fiber

2021-07-21 Thread hanabi1224 via Digitalmars-d-learn
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. Basically, I found D lang's logical thread communication is quite like Elixir's (process), I have programs written in both D and Elixir but the D version (release