goroutines vs vibe.d tasks
Sönke Ludwig via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 10 11:31:34 PDT 2015
Am 01.07.2015 um 20:09 schrieb Mathias Lang:
> On Tuesday, 30 June 2015 at 15:18:36 UTC, Jack Applegame wrote:
>> Just creating a bunch (10k) of sleeping (for 100 msecs) goroutines/tasks.
>>
>> Compilers
>> go: go version go1.4.2 linux/amd64
>> vibe.d: DMD64 D Compiler v2.067.1 linux/amd64, vibe.d 0.7.23
>>
>> Code
>> go: http://pastebin.com/2zBnGBpt
>> vibe.d: http://pastebin.com/JkpwSe47
>>
>> go version build with "go build test.go"
>> vibe.d version built with "dub build --build=release test.d"
>>
>> Results on my machine:
>>
>> go: 168.736462ms (overhead ~ 68ms)
>> vibe.d: 1944ms (overhead ~ 1844ms)
>>
>> Why creating of vibe.d tasks is so slow (more then 10 times)???
>
> In your dub.json, can you use the following:
>
> "subConfigurations": {
> "vibe-d": "libasync"
> },
> "dependencies": {
> "vibe-d": "~>0.7.24-beta.3"
> },
>
>
> Turns out it makes it much faster on my machine (371ms vs 1474ms). I
> guess it could be a good thing to investigate if we can make it the
> default in 0.7.25.
This sounds like the event_del() + event_add() sequence that is done in
the libevent driver causes this slowdown. If anyone knows of a faster
way to rearm a timer for libevent that would be great. Otherwise I don't
really know what to do about this (other than using a different driver).
As for libasync, making it the default is maybe still a little too
early, but we should definitely think about how to make it more
prominent for testing (maybe even still for 0.7.24).
More information about the Digitalmars-d-learn
mailing list