Guest User

Untitled

a guest
Nov 30th, 2016
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module main;
  2.  
  3. import std.stdio;
  4. import std.algorithm;
  5. import std.range;
  6. import std.bigint;
  7. import std.parallelism;
  8. import std.datetime;
  9.  
  10. class Timer
  11. {
  12.     static SysTime getCount()
  13.     {
  14.         return Clock.currTime();
  15.     }
  16.  
  17.     SysTime starttime;
  18.  
  19.     this() { starttime = getCount(); }
  20.     ~this()
  21.     {
  22.         writefln("elapsed time = %s", getCount() - starttime);
  23.     }
  24. }
  25.  
  26. const base = 100000;
  27.  
  28. int main(string[] args)
  29. {
  30.     BigInt result;
  31.     {
  32.         scope t = new Timer();
  33.         result =
  34.             taskPool.reduce!"a * b"(
  35.                 map!(fold!"cast(std.bigint.BigInt)a * b")
  36.                     (
  37.                         chunks(
  38.                             iota(1, base + 1),
  39.                             base / totalCPUs / 4
  40.                         )
  41.                     )
  42.             );
  43.     }
  44.     writefln("%s", result);
  45.     return 0;
  46. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×