auto sumtest4(Range)(Range range) @safe pure { return range.reduce!((a, b) => a + b); }is a more fair comparison. I get results within 15% of sumtest2 with this using dmd. I think with ldc this would be identical, but the version in homebrew is too old to compile this.
Re: Simple performance question from a newcomer
Kapps via Digitalmars-d-learn Sun, 21 Feb 2016 23:17:32 -0800
If you do want to test the differences between the range approach
and the loop approach, something like:
- Re: Simple performance quest... ixid via Digitalmars-d-learn
- Re: Simple performance q... Marc Schütz via Digitalmars-d-learn
- Re: Simple performan... ixid via Digitalmars-d-learn
- Re: Simple performan... dextorious via Digitalmars-d-learn
- Re: Simple performance q... bachmeier via Digitalmars-d-learn
- Re: Simple performance q... dextorious via Digitalmars-d-learn
- Re: Simple performan... jmh530 via Digitalmars-d-learn
- Re: Simple performan... Mike Parker via Digitalmars-d-learn
- Re: Simple perf... dextorious via Digitalmars-d-learn
- Re: Simple ... jmh530 via Digitalmars-d-learn
- Re: Simple performance question from ... Kapps via Digitalmars-d-learn
- Re: Simple performance question ... Kapps via Digitalmars-d-learn