[fpc-devel] x86_64 Optimizer Overhaul

Martok listbox at martoks-place.de
Sat Dec 15 19:01:31 CET 2018


Am 15.12.2018 um 17:12 schrieb Florian Klämpfl:
> The memory manager itself pools already, so no need for the compiler. If somebody wants to improve the heap manager:
> implement OS supported re-allocations (OS can move memory by just shuffling pages).

Very much agree, it's not a user program's job to work around the standard
memory manager in daily use. Doing that is a C++-ism that shouldn't exist in a
sane environment ;-)

I just tested something, and I'm a surprised by how big the difference is. This
simple test is 1.5 times slower in FPC/trunk/win32 than Delphi 2007 and 2.8
times slower for instances of TComponent. Medium-size GetMemory (I tested 123
bytes) is 22 times slower in FPC.
Looks like there is quite some potential there.


const COUNT=10000;
var
  t1, t2: dword;
  objs: array[0..10000] of TObject;
  i, j: integer;
begin
  t1:= Gettickcount;
  for i := 0 to COUNT - 1 do begin
    for j := 0 to high(objs) do
      objs[j]:= TObject.Create;
    for j := 0 to high(objs) do
      objs[j].Free;
  end;
  t2:= Gettickcount;

  writeln((t2-t1)/COUNT:10:3, 'ms');
  Readln;
end.

-- 
Regards,
Martok





More information about the fpc-devel mailing list