Unfortunately, this is not a very good example for
std.parallelism, since the measured times are better using the
std.algorithm.map calls. I know from past experience that
std.parallelism routines can work well when the work is spread
out correctly, so this example could be improved.
This is
and, finally, this works using the taskPool.map, as in the
std.parallelism example. So, the trick appears to be that the
call to chomp is needed.
auto lineRange = File(fn).byLineCopy();
auto chomped = std.algorithm.map!"a.chomp"(lineRange);
auto nums = taskPool.map!(to!
This also works.
auto sm = File(fn).byLineCopy()
.map!"a.chomp"()
.map!(to!double)
.map!"a.log10"()
.sum();
writeln("sum=",sm);
This appears to work ... at least, no exception:
auto sm = File(fn).byLine(KeepTerminator.no)
.map!"a.chomp"()
.map!"a.idup"()
.map!(to!double)
.map!"a.log10"()
.sum();
writeln("sum=",sm);