On 10/1/16 7:33 AM, Andrei Alexandrescu wrote:
On 10/1/16 3:13 AM, Martin Nowak wrote:
The fact that it's not possible to overload < but have to use the
ternary opCmp is even a performance problem. All std algorithms only use
less as a predicate, leading to lots of unnecessary cycles when e.g.
sorting UDTs.

I've also been often annoyed by having to write

return a < b ? -1 : a > b;

in e.g. checkedint. Does inlining take care of this? -- Andrei

Apparently in dmd the generated code is less efficient: https://goo.gl/OWxbA0. In gdc it's the same: https://godbolt.org/g/NmUyXM. I couldn't test with ldc, http://ldc.acomirei.ru seems down. -- Andrei

Reply via email to