Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module main;
- import std.stdio;
- import std.algorithm;
- import std.range;
- import std.bigint;
- import std.parallelism;
- import std.datetime;
- class Timer
- {
- static SysTime getCount()
- {
- return Clock.currTime();
- }
- SysTime starttime;
- this() { starttime = getCount(); }
- ~this()
- {
- writefln("elapsed time = %s", getCount() - starttime);
- }
- }
- const base = 100000;
- int main(string[] args)
- {
- BigInt result;
- {
- scope t = new Timer();
- result =
- taskPool.reduce!"a * b"(
- map!(fold!"cast(std.bigint.BigInt)a * b")
- (
- chunks(
- iota(1, base + 1),
- base / totalCPUs / 4
- )
- )
- );
- }
- writefln("%s", result);
- return 0;
- }
RAW Paste Data