Thread overview
[Issue 6064] New: std.array.join is unnecessarily slow for strings
May 27, 2011
Vladimir Panteleev
Jul 16, 2011
Jonathan M Davis
Jul 16, 2011
Jonathan M Davis
May 27, 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@gmx.com
        ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow@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: -------
July 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6064



--- Comment #1 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-07-15 23:28:30 PDT ---
https://github.com/D-Programming-Language/phobos/pull/146

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6064


Jonathan M Davis <jmdavisProg@gmx.com> changed:

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


--- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2011-07-16 15:56:54 PDT ---
Fixed: https://github.com/D-Programming-Language/phobos/commit/55fc7a2154c208cca05f16614ae9ca75c7b62911

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 17, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6064


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #3 from bearophile_hugs@eml.cc 2011-07-16 17:58:00 PDT ---
*** Issue 6271 has been marked as a duplicate of this issue. ***

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