On 10/03/2012 12:11 AM, Timon Gehr wrote:
...$ cat ixidbench.d module main; import std.stdio, std.algorithm, std.range, std.datetime; enum MAX = 10_000_000_000UL; void main() { StopWatch sw; sw.start; auto sum1 = MAX.iota.map!(x => x * x).reduce!"a + b"; sw.stop; sw.peek.msecs.writeln("msecs"); sum1.writeln; sw.reset; sw.start; ulong sum2 = 0; foreach(i;0..MAX) sum2 += i * i; sw.stop; sw.peek.msecs.writeln("msecs"); sum2.writeln; } $ ldmd2 -O -release -inline ixidbench.d -ofixidbench $ ./ixidbench 6528msecs 7032546979563742720 7518msecs 7032546979563742720
$ gdmd -O -release -inline ixidbench.d -ofixidbench $ ./ixidbench 11250msecs 7032546979563742720 11233msecs 7032546979563742720
