Advertisement
thornik

Bench 'nested loop' for D

Dec 5th, 2017
2,273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.46 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement