Re: Performance of default and enum parameters

2018-02-07 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 23:18:53 UTC, H. S. Teoh wrote: [snip] Appreciate the detailed reply. I had tried to look at the assembly with that tool recently discussed in the announce thread, but there was so much extra stuff reported that I threw up my hands.

Re: Performance of default and enum parameters

2018-02-07 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Feb 07, 2018 at 11:04:29PM +, jmh530 via Digitalmars-d-learn wrote: [...] > If check is not passed, I think it depends on how default function > arguments work. I could imagine that it works in two ways: 1) if you > call bar(x), then the compiler effectively re-writes it to bar(x, >

Performance of default and enum parameters

2018-02-07 Thread jmh530 via Digitalmars-d-learn
I'm a little curious on the impact of default and enum parameters on performance. In the simple example below, I have foo and bar that return different results depending on a bool. Foo is a template with check as a template parameter and bar is a normal function. foo creates two different