www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18342] New: std.concurrency needs to be optimized

https://issues.dlang.org/show_bug.cgi?id=18342

          Issue ID: 18342
           Summary: std.concurrency needs to be optimized
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

I recently used D on a C++ performance Meetup where they were testing
submitting functions to a worker thread and guess what - D was 5x slower than
C++.


There's lots of slow stuff going on in `std.concurrency`

- it uses double mutex-locking - once in `put`
(https://github.com/dlang/phobos/blob/931a25126b4fabaca0ed261d145c9aa444a193f7/std/concurrency.d#L1904)
and once in the List itself

- it uses the GC for all allocation

- the list implementation isn't very efficient


The challenge in case someone is interested:

https://github.com/Voultapher/Fast-Code-Competition

--
Jan 30 2018