fork(24) download
  1. program Time;
  2. uses BaseUnix, Unix;
  3. var
  4. start, finish, res: int64;
  5. n, i, j: Integer;
  6. g: Array of Array of Integer;
  7. t: Cardinal;
  8. function GetTickCount: Cardinal; stdcall;
  9. var
  10. t: timeval;
  11. begin
  12. fpgettimeofday(@t, nil);
  13. GetTickCount := t.tv_sec * 1000 + t.tv_usec div 1000;
  14. end;
  15. begin
  16. n := 8000;
  17. SetLength(g, n, n);
  18. t := GetTickCount;
  19. for i:=1 to n-1 do
  20. for j:=1 to n-1 do
  21. g[i,j] := 1;
  22. writeln('Time by rows:', GetTickCount - t, ' tics' );
  23. t := GetTickCount;
  24. for i:=1 to n-1 do
  25. for j:=1 to n - 1 do
  26. g[j,i] := 1;
  27. writeln('Time by cols:', GetTickCount - t, ' tics' );
  28. end.
Success #stdin #stdout 2.18s 256KB
stdin
Standard input is empty
stdout
Time by rows:331 tics
Time by cols:1742 tics