thornik

Bench 'nested loop' for D

Dec 5th, 2017
583
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ldc2.exe -release -m64 -O nestedloop.d
  2.  
  3. import std.stdio;
  4. import std.conv;
  5.  
  6. void main(string[] args)
  7. {
  8.     int n = args.length < 2 ? 1 : to!int(args[1]);
  9.     ulong x=0;
  10.  
  11.     for (int a=0; a<n; a++)
  12.         for (int b=0; b<n; b++)
  13.             for (int c=0; c<n; c++)
  14.                 for (int d=0; d<n; d++)
  15.                     for (int e=0; e<n; e++)
  16.                         for (int f=0; f<n; f++)
  17.                             x++;
  18.  
  19.     writeln(x);
  20. }
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.

×