<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Di., 16. Feb. 2021, 19:21:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> <br>
> There we have:<br>
> <br>
> * slower creation of the class, because each implemented interface adds another VMT reference to the class which needs to be initialized.<br>
<br>
How bad is this? We need to make a test case we can profile. For example if you have a game that creates 1000 classes 60 frames per second. If adding interfaces to the classes hurts this process we may have a deal breaker.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">If you need to create 1000 class instances each frame then you have a flaw in your logic in my opinion. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
> * slow reference counting. Especially if it is thread safe and exception safe with the implicit exception block<br>
<br>
It's a whole other topic but FPC needs opt-in ARC at the language level for classes. Interfaces are not only slow but then you need to pass around a reference to the interface instead of the class you actually care about. It makes no sense to me whatsoever.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Interfaces are not slow because they are are interfaces! When you call a interface method it has the same costs as a virtual method call! And the cost for reference counting that interfaces have right now would be there for ARC as well. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>