[Issue 11531] New: For a faster std.algorithm.group on strings

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 16 13:28:08 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11531

           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 at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at 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
std.string.representation.

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: -------


More information about the Digitalmars-d-bugs mailing list