Inheritance and Performance

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.

Howdy, Stranger!

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