www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11531] New: For a faster std.algorithm.group on strings


           Summary: For a faster std.algorithm.group on strings
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-11-16 13:28:06 PST ---
This is a low-priority enhancement request.

From my tests I've seen you can speed up std.algorithm.group applied on strings
more than twice if you instead apply it on a immutable(ubyte)[] using

Dmitry Olshansky has suggested some ideas that can improve the performance of
std.algorithm.group applied on strings:

As to group it has to find runs of identical items. It can be speed up for
Unicode if you take into account 2 simple tricks:
- you don't need to decode - just identify the size of current dchar (stride)
and see how many repetitions of such follow it;
- special case if the current (w)char ASCII (or BMP for UTF-16) so as to speed
up counting (1 char vs variable length slice of 1-4 chars, ditto with wchar).

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