[fpc-devel]Re: Memory management
Aleksey V. Vaneev
picoder at sbis.komi.ru
Wed Mar 21 15:17:24 CET 2001
Hello,
Oh, sorry, guys. :) I've did an error in my calculations.. Those
83K's must be 166K. And yes, Delphi (3) is 4 times slower on this
task... But anyways... If 166K could be increased by 50 or 100%... :)
Of course TRY mechanism also gives a spice taste... Okay, I have to
wait. :)
Regarding algo I'm using (hey, you think I'm nuts? :) here it is:
----
uses SysUtils;
const
BufCount = 10000;
TryCount = 100;
var
Bufs: array [0..BufCount - 1] of Pointer;
i, j: LongInt;
t1, t2: Double;
begin
t1 := time;
for j := 0 to TryCount - 1 do
begin
i := 0;
while (i < BufCount) do
begin
GetMem (Bufs [i], 11 + i div 32);
i := i + 2;
end;
i := 1;
while (i < BufCount) do
begin
GetMem (Bufs [i], 57 + (BufCount - i) div 32);
FreeMem (Bufs [i - 1]);
i := i + 2;
end;
i := 1;
while (i < BufCount) do
begin
FreeMem (Bufs [i]);
i := i + 2;
end;
end;
t2 := (time - t1) * 86400.0;
WriteLn ('tries: ', BufCount * TryCount);
WriteLn ('ops/sec: ', BufCount * TryCount / t2 : 10 : 2);
end.
----
Best regards,
Aleksey mailto:picoder at sbis.komi.ru
More information about the fpc-devel
mailing list