October 08, 2007 [Issue 1556] New: Inefficient array concatenation (especially for 3+ arrays) | ||||
---|---|---|---|---|
| ||||
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. -- |
October 14, 2007 [Issue 1556] Inefficient array concatenation (especially for 3+ arrays) | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 -- |
Copyright © 1999-2021 by the D Language Foundation