www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13444] New: std.concurrency.Mailbox should use a ring buffer

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

          Issue ID: 13444
           Summary: std.concurrency.Mailbox should use a ring buffer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: performance
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: sean invisibleduck.org
          Reporter: andrea.9940 gmail.com

The current Mailbox implementation in std.concurency uses a private List 
struct where every call to .put() needs to allocate a new node from the GC.
A better alternative is a ring buffer which can do all the things the Mailbox
needs and faster in every way. The growing time can be compensated by a right
call to setMaxMailboxSize() and any random removal can be a swap of the last
element with the one being removed.

Forum link: http://forum.dlang.org/thread/fdmopylovwbozsclgacq forum.dlang.org

--
Sep 09 2014