Re: NexusDB Memory Manager version 2 released

From: Alex Zencovich (zencovich_at_pivotcube.com)
Date: 07/30/04


Date: Fri, 30 Jul 2004 17:04:50 +0300

Hi Hannes,

On pity I cannot to sent to you our software sources, sorry.
But I wrote simple test application which emulate some ways of memory use.

Here is pas source:
--------------------------------------------------------------------------
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

ptestrec = ^testrec;
testrec = record
a : smallint;
b : single;
c : boolean;
end;

ptestarray = ^testarray;
testarray = array of testrec;

const
  LARGECOUNT = 1000000;
  SMALLCOUNT = 5;
var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
   c1,c2 : integer;
   l1 : TList;
   a : ptestarray;
   i,j,k : integer;
   res : double;
begin

c1 := GetTickCount;

L1 := TList.Create;
for i := 0 to LARGECOUNT do
    begin
    if (i > 10) and (i mod 5 = 0) then
       begin
       k := i div 2;
       if i mod 10 = 0 then // force TList to relocate pointers
          begin
          a := l1.Items[k];
          l1.Delete(k);
          Setlength(a^,0);
          Dispose(a);
          Continue;
          end;
       if l1.Count > 500 then
          begin
          for k := l1.Count - 1 downto l1.Count - 501 do // perform long
read
              begin
              a := l1.Items[k];
              for j := 0 to SMALLCOUNT-1 do
                  res := res + (a^[j].b * Ord(a^[j].c));
              end;
          end;
       end
    else
       begin
       try
          a := new(ptestarray);
          Setlength(a^,SMALLCOUNT);
          for j:= 0 to SMALLCOUNT-1 do
              begin
              a^[j].a := j;
              a^[j].b := a^[j].a * 3.14;
              a^[j].c := a^[j].a mod 2 = 0;
              end;
          l1.Add(a);
          except
          end;
       end;
    end;
c2 := GetTickCount;

Label1.Caption := 'Start time ' + IntToStr(c1);
Label2.Caption := 'Finish time ' + IntToStr(c2);
Label3.Caption := 'Work time ' + IntToStr(c2-c1);

for i := 0 to l1.Count - 1 do
    begin
    a := l1.Items[i];
    Setlength(a^,0);
    Dispose(a);
    l1.Items[i] := nil;
    end;
l1.Free;

end;

end.
------------------------------------------------

My results (Athlon XP 2800 512 MB DDR3200 RAM)

Delphi MM 39219
NexusDB MM 42593

Little note:

There also in results MexuSDB MM show larger memory occupation (near 10 MB
more) but I see that via Windows Task manager only, do not perform special
memory checking.

--
Alex Zencovich
PivotWare Lab
------------------------
OLAP solutions for Delphi,C++ Builder and ActiveX environment
"Hannes Danzl[NDD]" <hannes@nexusdb.dbnexus.com> сообщил/сообщила в новостях
следующее: news:41098b2b$1@newsgroups.borland.com...
> Hi Alex
>
> > I did some simple tests of new version of MM (trial edition).
> >
> > But I was disappointed by results: it show me 10-25% badly
> > performance than Delphi's native MM.
> >
> > The test I did was very simple: I prepare 2 builds of our demo
> > application - with NexusDB MM and without one.
>
> Any chance to get hold of this test? We are constantly trying to improve
our
> products if we can, so small examples of these issues would be very
helpful.
>
> > But most routines which work with sequential array access like
> >
> > for i := 0 to Count - 1 do
> >     a[i] := b[i] + c[i];
> >
> > show  significantly poor performance than Delphi MM (up 25%)
>
> I've tried this with
>
> var
>   a, b,c : array of Integer;
>   i, j : Integer;
>   aLength: integer;
> begin
>   aLength:=200;
>   SetLength(a, alength);
>   SetLength(b, alength);
>   SetLength(c, alength);
>
>    for i := 0 to 10 * 1000 * 1000 do begin
>      for k := 0 to alength-1 do begin    // Iterate
>        c[k]:=a[k]+b[k];
>      end;    // for
>    end;
> end;
>
> Whether I use NxMM or not, the timings are the same. I've also tried with
> arrays of length 50, 200, 500 and 1000, but i don't see any difference (as
i
> would expect it).
>
> > The application is single-tasked and single-threaded.
> >
> > Could you comment?
>
> Difficult and definetely not accurately at this time without having a test
case
> that shows your findings. If you can pls send it to "hannes at nexusdb"
and its
> a dot com domain (i'm sure you know how to put it together). Thanks!
>
> --
>
> Hannes Danzl [NexusDB Developer]
> Newsgroup archive at http://www.tamaracka.com/search.htm
>
>
>
>