Oh, my GoD! Goroutines on D

mw mingwu at gmail.com
Sun Jun 14 17:10:14 UTC 2020


On Tuesday, 26 May 2020 at 01:27:49 UTC, Mathias LANG wrote:
> 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?
...
> This is a problem that's of interest to me as well, and I've 
> been working on this for a few months (on and off).
> I had to eventually ditch `std.concurrency` because of some 
> design decisions that made things hard to work with.
>
> `std.concurrency`'s MessageBox were originally designed to be 
> only between threads. As such, they come with all the locking 
> you'd expect from a cross-thread message-passing data structure.
...
> It's still a problem we're working on, as some issues are 
> unique to D and we haven't found a good solution (e.g. 
> requiring `shared` for same-thread Fiber communication is quite 
> problematic). If we ever reach a satisfying solution I'll try 
> upstreaming it.
...

Have you tried lock-free queue?

https://www.liblfds.org/mediawiki/index.php?title=r7.1.1:Queue_(unbounded,_many_producer,_many_consumer)

Java uses the same algorithm for ConcurrentLinkedQueue (in C 
implementation).

I tried some small examples with liblfds, got slightly better 
performance than Java. Maybe we don’t want to reinvent the 
wheels, esp the well tested ones.





More information about the Digitalmars-d mailing list