Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-03

Memory management

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Aleksey V. Vaneev

Hello,

Can be there anything done to improve memmanager's performance? Simple test shows ~83000 GetMems+FreeMems per second on my i486-100MHz (under win95). That's a way little...
And the fact that TRY blocks use ordinary memory allocation, all this gives a weird overall sight...

Best regards,
Aleksey

Reply by email

Michael Van Canneyt
to Aleksey V. Vaneev
Aleksey V. Vaneev wrote 7 lines
Hello, Can be there anything done to improve memmanager's performance? Simple test shows ~83000 GetMems+FreeMems per second on my i486-100MHz (under win95). That's a way little... And the fact that TRY blocks use ordinary memory allocation, all this gives a weird overall sight...

The Try/Finally scheme is being looked in, but this is going to take a while, since it is not an easy matter.

As for the speed of the memory manager, can you send a testprogram so I can compare with Delphi/TP/Kylix ?

Michael.

Reply by email

Peter Vreman
Show quoted text 5 lines
Can be there anything done to improve memmanager's performance? Simple test shows ~83000 GetMems+FreeMems per second on my i486-100MHz (under win95). That's a way little... And the fact that TRY blocks use ordinary memory allocation, all this gives a weird overall sight...

The memory manager is already a lot faster with generic use then the one in Tp7 or Delphi.

A test with

getmem(p,10000)
freemem(p)

is totally useless as a lot of programs also allocate and free more blocks in between resultting in a very different situation.

If you really need a specific memorymanager implementation you can write your own memorymanager and use it by calling SetMemoryManager()

Reply by email

Aleksey V. Vaneev

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

Reply by email

Peter Vreman
Show quoted text 7 lines
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. :)

You mean the try calls in the heapmanager? Those are only included if you are compiling the RTL with the MT define. And the exception blocks are stored on the stack in the 1.1 compiler.

Regarding algo I'm using (hey, you think I'm nuts? :) here it is:

It was just a standard question as you didn't post anything about the algo.

But in general use the best algo to test the heap manager is still the compiler self.

Reply by email