On Sat, Jan 27, 2018 at 07:41:21PM +0000, Matt via Digitalmars-d-learn wrote: > Playing around with Godbolt, D seems to generate an embarassing amount > of assembly for a simple function (50ish for squaring an int vs 4 for > C++ and 7 for Rust). Even Go compiles to less assembly. > > Is there something I'm missing?
If you're looking for efficiency of generated code, use gdc or ldc. While dmd is the reference compiler with the latest and greatest bleeding-edge features, it's not known to be the best at generating optimized code, even if you run it with -O. If code size / efficiency is important to you, I highly recommend using gdc or ldc instead. T -- Век живи - век учись. А дураком помрёшь.