Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Inheritance and Performance

szluhaszluha Posts: 29Member
I have a question concerning performance:

I developed an information system that uses many object types that all inherit from TMySuperObject. Another class then manages a web of arrays of these objects, with a overloaded routine called fetch for each object type that searches the web of arrays to return an instance of a specific object in memory.

Which one of the following scenarios would offer best performance (considering a web of 100's of arrays with 1000's of large objects each):


function TMyManager.fetch(theObjecttype1_ID : TObjecttype1_ID) : TMySuperObject; overload;

function TMyManager.fetch(theObjecttype2_ID : TObjecttype2_ID) : TMySuperObject; overload; // etc.

...then to use the function:

anObject := TObjecttype1(manager.fetch(objecttype1_ID));


function TMyManager.fetch(theObjecttype1_ID : TObjecttype1_ID) : TObjecttype1; overload;

function TMyManager.fetch(theObjecttype2_ID : TObjecttype2_ID) : TObjecttype2; overload; // etc.

...then to use the function:

anObject := manager.fetch(objecttype1_ID);


Sign In or Register to comment.