D Paste by FeepingCreature
Description: test119.d
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | gentoo-pc ~ $ cat test116.d && gdc-build test116.d -o test116 -O2 && ./test116 module test116; import tools.base, tools.time; float mean(T)(T iterable) { auto sum = 0.0, length = 0; foreach (value; iterable) { sum += value; length ++; } return sum / length; } import std.stdio; void main() { auto start = sec(); scope(exit) writefln("Time: ", sec() - start); writefln(mean(Range[1..10_000_000])); } gdc -J. test116.d tools/base.d tools/smart_import.d tools/tests.d tools/log.d to ols/functional.d tools/time.d -o test116 -O2 5e+06 Time: 0.20258 |