[Issue 9477] New: String (and array) comparisons are needlessly very slow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 8 01:18:12 PST 2013


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

           Summary: String (and array) comparisons are needlessly very
                    slow
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: performance
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2013-02-08 11:18:10 EET ---
While profiling one of my programs, I've noticed a performance issue in an area
that I wouldn't expect to be slow: string comparisons.

It looks like array comparisons go through the rather convoluted TypeInfo
equality code, which contains a few indirect calls and calls to runtime code.
It can be inlined/optimized to a length comparison and a memcmp call.

If the length is known (static arrays), the length check can be skipped, and
for short arrays the comparison can even be inlined. Bearophile previously
reported this problem for static arrays in issue 6658.

I should note that a slice copy currently compiles to a memcpy call.

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