www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



D.gnu - [Issue 1556] New: Inefficient array concatenation (especially for 3+ arrays)

↑ ↓ ← d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1556

           Summary: Inefficient array concatenation (especially for 3+
                    arrays)
           Product: DGCC aka GDC
           Version: 0.24
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: fvbommel wxs.nl


GDC (0.24) compiles "a~b~c~d~e~f~g~h" (where all variables are arrays) to
multiple invocations of _d_arraycatnT, a function which can handle any number
of arrays but only seems to get called for two at a time. This causes N-1
function calls (each of which performs an allocation) instead of only one. This
is inefficient and causes extra garbage on the heap.

GDC also generates calls to this multi-array function for a simple 2-array
case, even though gphobos has _d_arraycatT especially for this purpose, without
the overhead of vararg handling.

DMD (both 1.022 and 1.020 on which GDC 0.24 was based) does this right, calling
_d_arraycatT for a 2-array concat and _d_arraycatnT to concatenate 3+ arrays.


Note: I'm tempted to add keyword "wrong-code" to this report, but the code
*does* return the right result (an array filled with the concatenation of the
initial arrays) so I'm not sure if it applies.


-- 
Oct 08 2007
↑ ↓ → d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1556


dvdfrdmn users.sf.net changed:

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




------- Comment #1 from dvdfrdmn users.sf.net  2007-10-13 21:13 -------
Fixed in svn 185 / release 0.25


-- 
Oct 13 2007