View mode: basic / threaded / horizontal-split · Log in · Help
February 08, 2013
[Issue 9477] New: String (and array) comparisons are needlessly very slow
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@puremagic.com
       ReportedBy: thecybershadow@gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow@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: -------
March 31, 2013
[Issue 9477] String (and array) comparisons are needlessly very slow
http://d.puremagic.com/issues/show_bug.cgi?id=9477


Walter Bright <bugzilla@digitalmars.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
                CC|                            |bugzilla@digitalmars.com


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2013-03-31 00:59:25 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1766

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 31, 2013
[Issue 9477] String (and array) comparisons are needlessly very slow
http://d.puremagic.com/issues/show_bug.cgi?id=9477



--- Comment #2 from github-bugzilla@puremagic.com 2013-03-31 01:02:10 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c984175cf25dfa17b3956e8e33ff83547fa56b0a
Optimize simple array comparison (Issue 9477)

https://github.com/D-Programming-Language/dmd/commit/8b9d88d19fe4bb239209c004230fd5ac271436c3
Merge pull request #1766 from CyberShadow/fix9477

Optimize simple array comparisons (Issue 9477)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2013
[Issue 9477] String (and array) comparisons are needlessly very slow
http://d.puremagic.com/issues/show_bug.cgi?id=9477


bearophile_hugs@eml.cc changed:

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


--- Comment #3 from bearophile_hugs@eml.cc 2013-04-01 14:55:13 PDT ---
See also Issue 6658

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home