www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2528] New: Arrays in Phobos shold be pre-allocated.

reply d-bugmail puremagic.com writes:
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.


-- 
Dec 20 2008
next sibling parent d-bugmail puremagic.com writes:
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.


-- 
Dec 20 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2528


andrei metalanguage.com changed:

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




-- 
Dec 20 2008
prev sibling parent d-bugmail puremagic.com writes:
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.


-- 
Apr 24 2009