Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Most efficient function/procedure placing

Status
Not open for further replies.

StevenK

Programmer
Jan 5, 2001
1,294
GB
I'm not sure if anyone can help me this this question.
If I'm making use of a function / procedure in multiple places in an application I will often place the function / procedure in a 'Global' unit accessible by the other forms / units. Is this the best place for it ?
Someone suggested to me that they had more efficiency when they replicated (and therefore would have to maintain) the same function / procedure in each of the forms / units it was to be used in.
Has anyone got evidence either way on this one ?
Thanks in advance
Steve
 
The Delphi compiler, in general, creates such blindingly fast code that it's just not worth worrying about little things like this, unless (a) you're running in an incredibly processor-starved environment, or (b) you're running in some incredibly deeply nested loop. Since these things are seldom the case for the sorts of problems we use Delphi for, I almost never worry about getting those last few percent, and just make the code readable and maintainable.

Contrast the extra time you'll spend maintaining it versus the extra time the user will sit in front of it waiting for it to finish executing. If you spend even an extra minute on writing or maintaining it, it'd better be to save a whole lotta processor cycles. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top