Thread overview
[Issue 2528] New: Arrays in Phobos shold be pre-allocated.
Dec 21, 2008
d-bugmail
Dec 21, 2008
d-bugmail
Dec 21, 2008
d-bugmail
Apr 24, 2009
d-bugmail
December 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2528

           Summary: Arrays in Phobos shold be pre-allocated.
           Product: D
           Version: 2.022
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: dsimcha@yahoo.com


Looking at the sources to Phobos, I see several places, including std.algorithm.map(), and the array-to-array conversion function of std.conv, where the ~= operator is used, even though the length of the array returned by these functions is known at the beginning of the function.  This severely hurts the performance of these functions, given how slow ~= is.  Furthermore, even if ~= were efficient, reallocating an array instead of preallocating is still too inefficient when it can be trivially optimized out.


-- 

December 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2528


andrei@metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|bugzilla@digitalmars.com    |andrei@metalanguage.com




------- Comment #1 from andrei@metalanguage.com  2008-12-20 21:37 -------
Good point, will fix.


-- 

December 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2528


andrei@metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 

April 24, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2528


dsimcha@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from dsimcha@yahoo.com  2009-04-24 13:53 -------
This looks to have been resolved in the new Phobos.


--