Marco van de Voort wrote:
> Please don't keep in the dark any longer.
> 
> Benchmarks, benchmarks of binindex !!! :-)
> 

okay here are my benchmarks :)

AMD Athlon(tm) 64 Processor 3500+ 2200MHZ

Start ==== fcl.chm
Text Toc read time: 00.116
Bin Toc read time: 00.021
Text Index read time: 00.176
Bin Index read time: 00.020
Finish ==== fcl.chm

Start ==== lcl.chm
Text Toc read time: 00.215
Bin Toc read time: 00.193
Text Index read time: 01.176
Bin Index read time: 00.375
Finish ==== lcl.chm

Start ==== rtl.chm
Text Toc read time: 00.228
Bin Toc read time: 00.158
Text Index read time: 00.357
Bin Index read time: 00.155
Finish ==== rtl.chm

It's alot faster :) congratulations! Especially noticeable on large files.

I used the attached program to test.

Regards,

Andrew



program Project1;

{$mode objfpc}{$H+}

uses
  Classes, chmreader, chmsitemap, Sysutils;

var
  STime: TDateTime;
  Chm: TChmReader;

procedure ReadTextTOC;
var
  Stream: TMemoryStream;
  SM: TChmSiteMap;
begin
  Stream := Chm.GetObject(Chm.TOCFile);
  if Stream <> nil then begin
    SM := TChmSiteMap.Create(stTOC);
    SM.LoadFromStream(Stream);
    Stream.Free;
    SM.Free;
  end;
end;

procedure ReadBinTOC;
var
  SM: TChmSiteMap;
begin
  SM := Chm.GetTOCSitemap;
  if SM <> nil then
    SM.Free
  else
    WriteLn('No Binary TOC AVailable');
end;

procedure ReadTextIndex;
var
  Stream: TMemoryStream;
  SM: TChmSiteMap;
begin
  Stream := Chm.GetObject(Chm.IndexFile);
  if Stream <> nil then begin
    SM := TChmSiteMap.Create(stIndex);
    SM.LoadFromStream(Stream);
    Stream.Free;
    SM.Free;
  end;

end;

procedure ReadBinIndex;
var
  SM: TChmSiteMap;
begin
  SM := Chm.GetIndexSitemap;
  if SM <> nil then
    SM.Free
  else
    WriteLn('No Binary Index AVailable');

end;

procedure PrintTime(WhatItem: String; STime: TDateTime);
begin
  WriteLn(WhatItem + ' read time: ', FormatDateTime('ss.zzzz', now-STime));
end;


{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}

begin
  Chm := TChmReader.Create(TFileStream.Create(ParamStr(1), fmOpenRead), True);
  WriteLn('Start ==== ',ParamStr(1));

  STime := now;
  ReadTextTOC;
  PrintTime('Text Toc',STime);
  STime := now;
  ReadBinTOC;
  PrintTime('Bin Toc',STime);
  STime := now;
  ReadTextIndex;
  PrintTime('Text Index',STime);
  STime := now;
  ReadBinIndex;
  PrintTime('Bin Index',STime);
  Chm.Free;
  WriteLn('Finish ==== ',ParamStr(1));
end.

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to