July 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10667

           Summary: http://dlang.org/cppstrings.html benchmark example
                    doesn't really show off slices
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody@puremagic.com
        ReportedBy: jlquinn@optonline.net


--- Comment #0 from Jerry Quinn <jlquinn@optonline.net> 2013-07-18 19:46:29 PDT ---
While the wordcount benchmark programs do show what can be done with C++98 vs D2, this is not really a good demonstration of the performance benefits of slices.

The D program stores word counts in a hash map.  The C++ version given uses a map, which is required to be a balanced binary tree data structure.  For sizable input, the algorithmic advantage will swamp the savings from using slices.

This is also a small enough input that memory handling effects probably won't get noticed.  I suspect the D program never needs to run a GC cleanup before the end.

I highly suggest the C++ programs be converted to C++11 where unordered_map is available to remove the hidden algorithmic advantage.  Secondly, repeat the input a number of times so the timing is more meaningful.

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