[fpc-pascal] TPersistent overhead

Ryan Joseph ryan at thealchemistguild.com
Sun Mar 27 03:42:18 CEST 2016


Great, thanks Michael.

I had another idea. Is it really required to subclass TPersistent for RTTI information or can I just use {$M+} on the units that I need and leave the class hierarchy the same?

> On Mar 26, 2016, at 6:00 PM, fpc-pascal-request at lists.freepascal.org wrote:
> 
> On Sat, 26 Mar 2016, Ryan Joseph wrote:
> 
>> What are all the performance costs associated with subclassing TPersistent
>> for RTTI information?  I want to use this in some classes but
>> unfortunately the way my code is written I need to basically make all my
>> classes descend from TPersistent, even classes that don?t need RTTI
>> information.
> 
> There is none.
> 
>> I noticed in my project there is an extra .6 seconds of compile time when
>> I make the changes but are there any other performance costs to consider
>> during runt time or otherwise?  I could deal with .6 seconds at compile
>> even though 95% of that is waste but runtime is another story.
> 
> The overhead is most likely due to writing of RTTI tables.
> They are static, and add to the size of the binary, but do not incur speed
> penalties.
> 
> Michael.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list