digitalmars.D.bugs - [Issue 15951] New: Inefficiencies in struct initialization
- via Digitalmars-d-bugs (30/30) Apr 23 2016 https://issues.dlang.org/show_bug.cgi?id=15951
https://issues.dlang.org/show_bug.cgi?id=15951 Issue ID: 15951 Summary: Inefficiencies in struct initialization Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: andrei erdani.com I list this as an enhancement but it's a blocker for RCStr, which has a relatively large inline buffer (64 bytes). If that's compulsively initialized, it makes RCStr nigh unusable as a competitive string. The simplest case is an entirely uninitialized struct (with the equivalent C++ code): https://godbolt.org/g/uItGGc https://godbolt.org/g/6E1mkr The initialization sequence of the D code is large and slow. What we really want is to write a 0 in the last byte: https://godbolt.org/g/twDGbP https://godbolt.org/g/SRO5ql Again the D version does a lot of unnecessary work. Where we want to get is this: https://godbolt.org/g/B0Xvq3 https://godbolt.org/g/OE6N8C Here the D version should generate the same code as the C++ version. --
Apr 23 2016