Oh, my GoD! Goroutines on D
Bienlein
ffm2002 at web.de
Tue May 19 08:42:14 UTC 2020
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?
Go can easily have some ten thousand green threads. I once did a
test run to see how many. On a 4 GB machine 80.000 green threads
aka goroutines were created till out of memory occured.
Communicating sequential processes as in Go relies on being able
to create a large amount of threads. With a paradigm of threads
doing blocking takes on channels any application would otherwise
quickly run out of threads. In D something similar could be done
using fibers. Using fibers is also the approach chosen in Java
extending the JVM to have CSP-stye concurrency as in Go, see
https://www.youtube.com/watch?v=lIq-x_iI-kc
Then you also need continuations. Lets say inside a function a
blocking take is done on two channels in a row. The first channel
has some input, the next one has not. In between comes a context
switch. When switching back the value taken from the first
channel has to be put back into the context. This is why
continuations are needed.
Really nice work! Please keep it going :-)
More information about the Digitalmars-d
mailing list