View previous topic :: View next topic
|
Author |
Message |
Abirami.YN
New User
Joined: 16 Jul 2005 Posts: 15 Location: India - Chennai
|
|
|
|
Hi,
Can any body tell me about performance of IF(Nested If) and Evaluate?
Which one is better to use?
Thanks,
Abirami.YN |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi Abirami,
Shortening your instruction path can also improve your runtime efficiency, sometimes as dramatically as improving your I/O. Here are some tips for writing efficient procedure logic:
In a nested IF statement or an EVALUATE case structure, you can shorten your instruction path if you know in advance that certain conditions occur much more frequently than others. Test for these conditions early. That bypasses all the logic to test for the less common situations.
Hope this helps. |
|
Back to top |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
HI,
i think if you have more than 3 nested if's then it is better to go for Evaluate. |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi Abirami,
To be more precise EVALUATE will be efficient in most of the cases. It all depends on the situation how many conditions you are going to check. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
One thing apart from readability & more structured programming which supports use of EVALUATE over NESTED IF statements is that we can terminate it by a simple END-EVALUATE, instead of a long thread of IF chain may require an equally long END-IF chain.
Regards,
Priyesh. |
|
Back to top |
|
|
|