{$mode objfpc}{$h+}
uses
  contnrs, uhla, sysutils;

var
  t: Double;

procedure Benchmark;
begin
  Writeln((Now - t) * 24 * 60 * 60:0:3, ' sec');
end;

var
  hl: TFPHashList;
  hla: TFPHashListA;
  i: Integer;
  a: ShortString;
  b: AnsiString;
begin
Writeln(SizeOf(b));
  t := Now;
  for i := 1 to 3000000 do
    a := IntToStr(i);
  Benchmark;
  t := Now;
  for i := 1 to 3000000 do
    b := IntToStr(i);
  Benchmark;
  
  hl := TFPHashList.Create;
  for i := 1 to 2000000 do begin
    a := IntToStr(i);
    hl.Add(a, Pointer(i));
  end;
  write('short add:  ');
  Benchmark;
  t := Now;
  for i := 1 to 2000000 do begin
    a := IntToStr(i);
    hl.Find(a);
  end;
  write('short find: ');
  Benchmark;

  hla := TFPHashListA.Create;
  for i := 1 to 2000000 do begin
    b := IntToStr(i);
    hla.Add(b, Pointer(i));
  end;
  write('ansi add:   ');
  Benchmark;
  t := Now;
  for i := 1 to 2000000 do begin
    b := IntToStr(i);
    hla.Find(b);
  end;
  write('ansi find:  ');
  Benchmark;

end.
