Question Program Optimizing

Densi Prabath

New Member
when we coding , how to make a high performance program?

1)Find first .
if not avail.
2) if not can-find(first)
in this code statement which one is the fastest statement?

and also i want to know about "what are the best ways to optimize my program" &
"what are the codes what make program slow"..
thank you.:)
 

ForEachInvoiceDelete

Active Member
Can find is the fastest, it doesn't return the entire record to the buffer.

Rest of the questions need clarifying. I could write an entire essay on both subjects.
 

TomBascom

Curmudgeon
The number one performance killer is lack of actual performance testing to demonstrate where to focus ones efforts. (This is called "premature optimization".)

The number two performance killer is lack of understanding of indexes. 999 out 100 performance problems found in testing are directly related to poor index usage.

FIRST is a red flag. If you type FIRST in your code more than once a month and without spending at least 30 minutes writing an excellent comment explaining why you used FIRST then you are probably doing something very, very wrong. The first thing that FIRST tells me is that you do not understand your indexes. The second thing it tells me is that you do not understand your data.
 
I would add to Tom's comments, always use NO-LOCK or EXCLUSIVE-LOCK. Always define as NO-UNDO your vars def (like 99.99% of times).
You don't mention your progress version and env, but usually is better to use FOR FIELDS() instead FIND.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
The first thing that FIRST tells me is that you do not understand your indexes. The second thing it tells me is that you do not understand your data.
Third possibility: you've inherited a non-normalized schema that you can't change, but you still have to get work done.

Also, at the risk of enduring the slings and arrows of popular opinion, I'll say there are some valid use cases for using FIRST and LAST.
 

TomBascom

Curmudgeon
I'll go along with "some"... like I said, about once a month ;) Definitely NOT with every FIND or GET or FOR that you write.
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
and also i want to know about "what are the best ways to optimize my program" &
"what are the codes what make program slow"
As Tom said, don't spend time optimizing code that never runs or that doesn't contribute meaningfully to real-world problems. To address slowness you first need to know where your code is spending its time; which programs and which parts of them. Then you can work on determining why that code is time-consuming and how or if it should be refactored.

My advice: get to know how to use the application profiler and consume its output; read the Debugging and Troubleshooting manual; read the Triggers and Indexes manual.
 

Cringer

ProgressTalk.com Moderator
Staff member
No idea if the presentation works without the accompanying talk, but Paul Koufalis and Peter Judge did a very good workshop and talk on performance improvements at this year's EMEA PUG. OneDrive
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Peter and Paul are both great presenters who discuss the material in their slides, rather than just reading them to you. So you do miss some interesting and valuable stuff by not hearing the audio. That said, there's still lots of good material in those slides for people at many different levels of skill and experience in performance troubleshooting. It isn't just for novices.
 

Densi Prabath

New Member
I would add to Tom's comments, always use NO-LOCK or EXCLUSIVE-LOCK. Always define as NO-UNDO your vars def (like 99.99% of times).
You don't mention your progress version and env, but usually is better to use FOR FIELDS() instead FIND.
progress 9.1
windows server 2003
 
Top