<HTML>
<div><style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>I dare ask, does that mean we should avoid workarounds in the compiler (and our own programs) that aim to avoid constant construction and destruction of objects, and instead try to improve the memory manager?</div><div><br>
</div><div>So many discoveries!</div><br>
<div>Gareth aka. Kit</div><div><br>
</div><div>P.S. This thread is supposed to be for the x86_64 optimizer overhaul that I presented!<br>
</div> <br>
<br>
<span style="font-weight: bold;">On Sat 15/12/18 18:01 , Martok listbox@martoks-place.de sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">Am 15.12.2018 um 17:12 schrieb Florian Klämpfl:
<br>

<span style="color: rgb(102, 102, 102);">> The memory manager itself pools already, so no need for the compiler. If somebody wants to improve the heap manager:
</span><br>

<span style="color: rgb(102, 102, 102);">> implement OS supported re-allocations (OS can move memory by just shuffling pages).
</span><br>


<br>

Very much agree, it's not a user program's job to work around the standard
<br>

memory manager in daily use. Doing that is a C++-ism that shouldn't exist in a
<br>

sane environment ;-)
<br>


<br>

I just tested something, and I'm a surprised by how big the difference is. This
<br>

simple test is 1.5 times slower in FPC/trunk/win32 than Delphi 2007 and 2.8
<br>

times slower for instances of TComponent. Medium-size GetMemory (I tested 123
<br>

bytes) is 22 times slower in FPC.
<br>

Looks like there is quite some potential there.
<br>


<br>


<br>

const COUNT=10000;
<br>

var
<br>

  t1, t2: dword;
<br>

  objs: array[0..10000] of TObject;
<br>

  i, j: integer;
<br>

begin
<br>

  t1:= Gettickcount;
<br>

  for i := 0 to COUNT - 1 do begin
<br>

    for j := 0 to high(objs) do
<br>

      objs[j]:= TObject.Create;
<br>

    for j := 0 to high(objs) do
<br>

      objs[j].Free;
<br>

  end;
<br>

  t2:= Gettickcount;
<br>


<br>

  writeln((t2-t1)/COUNT:10:3, 'ms');
<br>

  Readln;
<br>

end.
<br>


<br>

-- 
<br>

Regards,
<br>

Martok
<br>


<br>


<br>

_______________________________________________
<br>

fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>

<a target="_blank" href="<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>"><span style="color: red;">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</span></a>
<br>

<br>

<br>

</blockquote></HTML>