http://d.puremagic.com/issues/show_bug.cgi?id=2888
Summary: [PATCH] float * 2.0 is unnecessarily slow Product: D Version: 2.029 Platform: PC OS/Version: Windows Status: NEW Keywords: patch, performance Severity: normal Priority: P2 Component: DMD AssignedTo: bugzi...@digitalmars.com ReportedBy: clugd...@yahoo.com.au DMD generates slow code in simple situations such as: double foo(double x) { return x*2; } It creates a floating-point constant 2.0, and then generates an FMUL to multiply by it. It's particularly slow in the 80-bit real case, where two instructions (FLD and FMULP) are required. The attached patch generates the fast and simple FADD ST(0), ST; instead. It only applies to float,double, real, not to complex numbers. --