[Issue 13444] New: std.concurrency.Mailbox should use a ring buffer

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 9 06:41:50 PDT 2014


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 at invisibleduck.org
          Reporter: andrea.9940 at 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

--


More information about the Digitalmars-d-bugs mailing list