[Issue 5282] New: Use memcmp or other appropriate optimizations for array comparison where possible

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 27 22:31:37 PST 2010


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

           Summary: Use memcmp or other appropriate optimizations for
                    array comparison where possible
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: jmdavisProg at gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg at gmx.com> 2010-11-27 22:30:10 PST ---
This thread makes it fairly clear that in some cases, array comparisons in D
are unnecessarily slow:
http://www.mail-archive.com/digitalmars-d@puremagic.com/msg43150.html

What likely should be done is to use memcmp in cases where you don't actually
need to call opEquals() on the individual elements of the arrays - such as when
comparing arrays of primitives or arrays of structs where none of the struct's
member variables have opEquals() (be they primitives or structs without an
opEquals() and no member variables with opEquals()). strings would naturally be
among the types which would benefit from the optimization.

Other optimizations for speeding up array comparisons may be appropriate, but I
do think that it's clear that array comparisons can be better optimized in many
common cases. Obviously, this isn't a high priority, but I do think that this
is an optimization which should be added at some point if we really want D to
be as fast as it should be.

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