const TESTELEMENTS=1000;
const ROUNDS=100000;

procedure Test96;
type
  TRFast=record
    r1: record
      a: integer;
      b: integer;
    end;
    r2: record
      c: integer;
      d: integer;
    end;
    r3: record
      e: integer;
      f: integer;
    end;
    r4: record
      g: integer;
      h: integer;
    end;
    r5: record
      a1: integer;
      b1: integer;
    end;
    r6: record
      c1: integer;
      d1: integer;
    end;
    r7: record
      e1: integer;
      f1: integer;
    end;
    r8: record
      g1: integer;
      h1: integer;
    end;
    r9: record
      a2: integer;
      b2: integer;
    end;
    r10: record
      c2: integer;
      d2: integer;
    end;
    r11: record
      e2: integer;
      f2: integer;
    end;
    r12: record
      g2: integer;
      h2: integer;
    end;
  end;
  TRSlow=record
    a: integer;
    b: integer;
    c: integer;
    d: integer;
    e: integer;
    f: integer;
    g: integer;
    h: integer;
    a1: integer;
    b1: integer;
    c1: integer;
    d1: integer;
    e1: integer;
    f1: integer;
    g1: integer;
    h1: integer;
    a2: integer;
    b2: integer;
    c2: integer;
    d2: integer;
    e2: integer;
    f2: integer;
    g2: integer;
    h2: integer;
  end;
var
  j,k: integer;
  ST,ET: TTimeStamp;
  ArFast: array of TRFast;
  ArSlow: array of TRSlow;
begin
  SetLength(ArFast,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArFast[0].r1:=ArFast[k].r1;
      ArFast[0].r2:=ArFast[k].r2;
      ArFast[0].r3:=ArFast[k].r3;
      ArFast[0].r4:=ArFast[k].r4;
      ArFast[0].r5:=ArFast[k].r5;
      ArFast[0].r6:=ArFast[k].r6;
      ArFast[0].r7:=ArFast[k].r7;
      ArFast[0].r8:=ArFast[k].r8;
      ArFast[0].r9:=ArFast[k].r9;
      ArFast[0].r10:=ArFast[k].r10;
      ArFast[0].r11:=ArFast[k].r11;
      ArFast[0].r12:=ArFast[k].r12;
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array fast (',sizeof(ArFast[0]),')  : ',ET.Time-ST.Time);

  SetLength(ArSlow,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArSlow[0]:=ArSlow[k];
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array slow (',sizeof(ArSlow[0]),')  : ',ET.Time-ST.Time);
end;

procedure Test64;
type
  TRFast=record
    r1: record
      a: integer;
      b: integer;
    end;
    r2: record
      c: integer;
      d: integer;
    end;
    r3: record
      e: integer;
      f: integer;
    end;
    r4: record
      g: integer;
      h: integer;
    end;
    r5: record
      a1: integer;
      b1: integer;
    end;
    r6: record
      c1: integer;
      d1: integer;
    end;
    r7: record
      e1: integer;
      f1: integer;
    end;
    r8: record
      g1: integer;
      h1: integer;
    end;
  end;
  TRSlow=record
    a: integer;
    b: integer;
    c: integer;
    d: integer;
    e: integer;
    f: integer;
    g: integer;
    h: integer;
    a1: integer;
    b1: integer;
    c1: integer;
    d1: integer;
    e1: integer;
    f1: integer;
    g1: integer;
    h1: integer;
  end;
var
  j,k: integer;
  ST,ET: TTimeStamp;
  ArFast: array of TRFast;
  ArSlow: array of TRSlow;
begin
  SetLength(ArFast,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArFast[0].r1:=ArFast[k].r1;
      ArFast[0].r2:=ArFast[k].r2;
      ArFast[0].r3:=ArFast[k].r3;
      ArFast[0].r4:=ArFast[k].r4;
      ArFast[0].r5:=ArFast[k].r5;
      ArFast[0].r6:=ArFast[k].r6;
      ArFast[0].r7:=ArFast[k].r7;
      ArFast[0].r8:=ArFast[k].r8;
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array fast (',sizeof(ArFast[0]),')  : ',ET.Time-ST.Time);

  SetLength(ArSlow,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArSlow[0]:=ArSlow[k];
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array slow (',sizeof(ArSlow[0]),')  : ',ET.Time-ST.Time);
end;

procedure Test32;
type
  TRFast=record
    r1: record
      a: integer;
      b: integer;
    end;
    r2: record
      c: integer;
      d: integer;
    end;
    r3: record
      e: integer;
      f: integer;
    end;
    r4: record
      g: integer;
      h: integer;
    end;
  end;
  TRSlow=record
    a: integer;
    b: integer;
    c: integer;
    d: integer;
    e: integer;
    f: integer;
    g: integer;
    h: integer;
  end;
var
  j,k: integer;
  ST,ET: TTimeStamp;
  ArFast: array of TRFast;
  ArSlow: array of TRSlow;
begin
  SetLength(ArFast,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArFast[0].r1:=ArFast[k].r1;
      ArFast[0].r2:=ArFast[k].r2;
      ArFast[0].r3:=ArFast[k].r3;
      ArFast[0].r4:=ArFast[k].r4;
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array fast (',sizeof(ArFast[0]),')  : ',ET.Time-ST.Time);

  SetLength(ArSlow,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArSlow[0]:=ArSlow[k];
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array slow (',sizeof(ArSlow[0]),')  : ',ET.Time-ST.Time);
end;

procedure Test16;
type
  TRFast=record
    r1: record
      a: integer;
      b: integer;
    end;
    r2: record
      c: integer;
      d: integer;
    end;
  end;
  TRSlow=record
    a: integer;
    b: integer;
    c: integer;
    d: integer;
  end;
var
  j,k: integer;
  ST,ET: TTimeStamp;
  ArFast: array of TRFast;
  ArSlow: array of TRSlow;
begin
  SetLength(ArFast,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArFast[0].r1:=ArFast[k].r1;
      ArFast[0].r2:=ArFast[k].r2;
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array fast (',sizeof(ArFast[0]),')  : ',ET.Time-ST.Time);

  SetLength(ArSlow,TESTELEMENTS);
  ST:=DateTimeToTimeStamp(Now);
  for j := 0 to ROUNDS do begin
    for k := 1 to TESTELEMENTS-1 do begin
      ArSlow[0]:=ArSlow[k];
    end;
  end;
  ET:=DateTimeToTimeStamp(Now);
  Writeln('Rounds: ',ROUNDS,' Array slow (',sizeof(ArSlow[0]),')  : ',ET.Time-ST.Time);
end;
