Advanced Delphi

Moderators: None (Apply to moderate this forum)
Number of threads: 333
Number of posts: 743

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Inheritance and Performance Posted by szluha on 17 Mar 2010 at 6:13 AM
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));

---------------------------------------
OR

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);

---------------------------------------





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.