[Issue 6064] New: std.array.join is unnecessarily slow for strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 27 13:44:52 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6064

           Summary: std.array.join is unnecessarily slow for strings
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: jmdavisProg at gmx.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2011-05-27 13:40:32 PDT ---
std.array.join(x) does not special-case for strings. This causes joined strings
to be copied character-by-character.

std.array.join(x,x) does attempt to special-case for strings, but only when
only the first argument is a string - and even then, this doesn't work:

C:\...\std\array.d(778): Error: template std.algorithm.copy(Range1,Range2) if
(isInputRange!(Range1) && isOutputRange!(Range2,ElementType!(Range1))) does not
match any function template declaration
C:\...\std\array.d(778): Error: template std.algorithm.copy(Range1,Range2) if
(isInputRange!(Range1) && isOutputRange!(Range2,ElementType!(Range1))) cannot
deduce template function from argument types !()(Result,string)
test.d(9): Error: template instance
std.array.join!(string[],Map!(result,string)) error instantiating

Program:

import std.array;
import std.algorithm;

void main()
{
    string[] arr;
    string sep;

    join(arr, map!"a"(sep));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list