<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div id="smartTemplate4-template">Hi,<br>
</div>
<div><br>
</div>
<div>main fails to cycle compile rtl-console/fv-package due to a
TEnhancedVideoCell record.<br>
</div>
<div>fixes does not have a TEnhancedVideoCell record, so it cannot
fail there.<br>
</div>
<div><br>
</div>
<div>But if I copy TEnhancedVideoCell into a new project file, I can
compile it with the patched fixes, too<br>
</div>
<div><br>
</div>
<div>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">What is the performance improvement here </pre>
</blockquote>
</div>
<div><br>
</div>
<div>I did not benchmark it. <br>
</div>
<div><br>
</div>
<div>I tested my test cases after dozen of unrelated changes. I
started with COM interfaces for reference counting. There the run
time was like 80 seconds. Then I changed it to managed records.
Now it is around 30 seconds. <br>
</div>
<div><br>
</div>
<div>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">and why was it done the old way?</pre>
</blockquote>
<br>
</div>
<div>what old way?<br>
<br>
<br>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Another question I had about them is why they can't be inlined.
</pre>
</blockquote>
</div>
<div>
<p><br>
</p>
<p>with my patch, "copy" can be inlined! <br>
</p>
initialize and finalize some times, too.<br>
</div>
<div><br>
</div>
<div>There are two places that call them. compiler/nld.pas and
compiler/ngenutil.pas where it creates the call nodes. There my
patch turns them into ordinary function calls, which can be
inlined like any other function call.<br>
</div>
<div>Then there is compiler/hlcgobj.pas, which calls
initialize/finalize for local or temporary variables. That appears
to happen after the inlining is done. Perhaps it needs to do the
inlining first to know which variables are there, and afterwards
it could not change them anymore.</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
Bye,<br>
Benito <br>
</div>
<div class="moz-cite-prefix">On 22.07.23 15:47, Hairy Pixels via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:BE68559C-8831-4A26-B0F2-8099BD56B683@gmail.com">
<pre class="moz-quote-pre" wrap="">Nice work, I have no answer for you though. :)
What is the performance improvement here and why was it done the old way?
Another question I had about them is why they can't be inlined. Does anyone have the answer for that? Not being able to be inlined is the biggest performance problem I suspect, followed by the copy operator which gets called redundantly on assignment to temporary memory.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Jul 22, 2023, at 7:07 AM, Benito van der Zander via fpc-devel <a class="moz-txt-link-rfc2396E" href="mailto:fpc-devel@lists.freepascal.org"><fpc-devel@lists.freepascal.org></a> wrote:
Hallo,
i made a patch for faster management operators: <a class="moz-txt-link-freetext" href="https://gitlab.com/benibela/fpc-source/-/commit/1aa0866112c97dd0c7ed7f3a4b1c7ab6420cb942">https://gitlab.com/benibela/fpc-source/-/commit/1aa0866112c97dd0c7ed7f3a4b1c7ab6420cb942</a>
And it has been working fine on fixes3_2, but when I tried to apply it on main, I get an error message:
views.inc(4318,17) Error: Wrong number of parameters specified for call to "$copy"
video.inc(180,35) Error: Found declaration: operator copy(constref TEnhancedVideoCell;var TEnhancedVideoCell); Static;
I have been creating two paranodes for the call like that:
if is_rtti_managed_type(left.resultdef) and is_record(left.resultdef)
and (mop_copy in trecordsymtable(left.resultdef.getsymtable(gs_record)).managementoperators) then
begin
hsym := tprocsym(left.resultdef.getsymtable(gs_record).Find('copy'));
hp := ccallparanode.create(left, ccallparanode.create(right, nil));
result := ccallnode.create(hp,hsym,hsym.owner,nil,[],nil);
should it be done differently?
Viele Grüße,
Benito
_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Regards,
Ryan Joseph
_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
</body>
</html>