Benito van der Zander via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb am Di., 16. Feb. 2021, 23:35:
> 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. > > > But it is not calling the method, it is calling the wrapper function > > That is a additional second method call/jump for every interface method > call. > > > E.g. _AddRef on TInterfacedObject as an interface, does not call > TInterfacedObject._AddRef, it calls this: > WRPR_$SYSTEM_$$_TINTERFACEDOBJECT_$_IUNKNOWN_$_1_$_SYSTEM$_$TINTERFACEDOBJECT_$__$$__ADDREF$$LONGINT > > 0000000000424600 4883ef10 sub $0x10,%rdi > 0000000000424604 e997f8feff jmpq 0x413ea0 > <SYSTEM$_$TINTERFACEDOBJECT_$__$$__ADDREF$$LONGINT> > It's an *unconditional* jump. The branch prediction of the CPU should handle this without much penalty. Regards, Sven >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal