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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

question about performance of an app 1

Status
Not open for further replies.

nnmmss

Programmer
Sep 7, 2004
123
0
0
IR
i have a procedure in my application which i use it almost in all form. it changes the values of some textboxes in each form.now my question is that. which one these two methos is better for having better performance.

if i program these procedure as public procedure and call just this one procedure or i should have in any form which want to use it?
 
Creating the procedure in each form will be faster, but don't do it.

Imagine it like this... You're putting up a shelf in your house, and you need a screw driver. If the screw driver is in the same room as you are, you'll get the screw driver sooner than if you have to go to the garage to get it.

Now, as silly as it seems, imagine you find a defect in the screw driver. You must go to every room in your house and fix the screw driver. Instead, if you had just one screwdriver, and you always keep it in the garage, then you only need to fix one screwdriver.

By using private functions within a form, performance will be slightly better. In fact, the difference in time would probably be measured in micro-seconds. Seriously, the difference in performance will never be noticed. You're problem is that the performance of the function is slow, not where the function resides. By keeping the subroutine public in a shared module, you will improve the quality of your app by reusing code. Find a bug, fix it once, and it's fixed for all forms that use it.

You should focus your energy in to fixing the performance of that subroutine.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
I really like that analogy George. I'm gonna have to remember that one. A Star to you for that :)
 
>Creating the procedure in each form will be faster

Not by much ...
 
>> In fact, the difference in time would probably be measured in micro-seconds.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
George makes a good point about performance overhead vs. maintenance overhead. Both add to the TCO (total cost of ownership) of an application, but maintenance is in most cases more expensive than performance hits in terms of money. Putting your code in one place is to be strongly preferred.

HTH

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top