Summary: Reserve for associative arrays
           Product: D
           Version: 2.021
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]

It appears that adding an element to an associative array always triggers a
memory allocation.  Especially in multithreaded code, this is inefficient.  It
would be nice if associative arrays had a .reserve(size_t n) property, which
reserved enough space for n objects, and stored the capacity internally.  The
idea is that, until the reserve buffer is exhausted, no interaction of any kind
with the GC would be needed to add an element to the AA.


Reply via email to