Oh, my GoD! Goroutines on D

Jin nin-jin at ya.ru
Sun Jun 14 14:24:29 UTC 2020


On Monday, 25 May 2020 at 16:26:31 UTC, Jin wrote:
> On Saturday, 16 May 2020 at 20:06:47 UTC, mw wrote:
>> On Tuesday, 29 March 2016 at 17:10:02 UTC, Jin wrote:
>>>
>>> http://wiki.dlang.org/Go_to_D
>>
>> Any performance comparison with Go? esp. in real word scenario?
>>
>> Can it easily handle hundreds of (go)routines?
>
> I have updated the code. But it isn't ready to use currently 
> because:
>
> 1. I rewrote code to use std.parallelism instead of vibe.d. So, 
> it's difficult to integrate fibers with tasks. Now, every tasks 
> spinlocks on waiting channel and main thread don't useful work.
>
> 2. Race condition. I'm going to closely review algorithm.
>
> Currently it's twice slower than Go. On y machine:
>
>>go run app.go --release
> Workers Result          Time
> 4       499500000       27.9226ms
>
>>dub --quiet --build=release
> Workers Result          Time
> 3       499500000       64 ms
>
> It would be cool if someone help me with it. There are 
> docstrings, tests and diagrams. I'll explain more if someone 
> joins.

I have fixed all issues, and it's usable now. But I had to return 
vibe-core dependency. Now it's slow down:

> .\compare.cmd
>go run app.go --release
Workers Result          Time
4       4999500000      25.9163ms
>dub --quiet --build=release
Workers Result          Time
4       4999500000      116 ms

And I had to reduce the count of "threads" to 100 because 
vibe-core fails on 1000.

And I have created thread on dlang/project with an explanation of 
my vision of concurrency in D: 
https://github.com/dlang/projects/issues/65


More information about the Digitalmars-d mailing list