[fpc-pascal] interfaces and smartpointers [was Traits Proposal]

Ryan Joseph genericptr at gmail.com
Wed Feb 17 21:43:45 CET 2021



> On Feb 17, 2021, at 11:11 AM, Benito van der Zander via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> just open the disassembler window in Lazarus and single step through all the instructions. Then you see everything
> 
> create alone calls a bunch of methods:
> 
> TInterfacedObject.NewInstance 
> TObject.NewInstance 
> getmem
> TObject.InitInstance
> fillchar
> InitInterfacePointers
> fpc_pushexceptaddr (on linux only?)
> fpc_setjmp
> TInterfacedObject.AfterConstruction
> 

So where is your 10% performance hit coming from then? 

on init:

InitInterfacePointers or TInterfacedObject.AfterConstruction? 

otherwise, during the wrapper function? As Sven pointed out the ref counting happens with records operators also. ARC is general may just be slow if you implement it everywhere.


Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list