Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which Should I Use IF/ENDIF or IIF
Message
De
17/06/2002 13:18:07
Joel Leach
Memorial Business Systems, Inc.
Tennessie, États-Unis
 
 
À
14/06/2002 16:41:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00668532
Message ID:
00669331
Vues:
22
>>I didn't do a real thorough test (I had other apps open and only ran about 4 iterations of the test). However, on a PIII 933, I got inconsistent results. In some cases IIF() was faster and in others it wasn't. Which is truly faster, however, took a back seat to the differences between the two over a million iterations. The largest amount was less than 1/10th of a second. So I would have to conclude that unless the routine was being called in excess of a million times, which is actually faster is pretty much of a moot point.
>
>I just tried a few times with VFP 7 SP1 on a PIII 833 and a ton of stuff open. (Too lazy to shut it all down. <g>)
>
>IF was slightly faster than IIF() for me four times running (2.4 vs. 2.1, roughly).
>
>Tamar

So much for conventional wisdom <g>, although you can't blame us for thinking it. This is from the VFP documentation:

"Tip This function can be used in place of IF ... ENDIF for simple conditional expressions, and is especially useful in report and label expressions that conditionally specify field contents. The IIF( ) function also executes faster than an equivalent IF ... ENDIF."
Joel Leach
Microsoft Certified Professional
Blog: http://www.joelleach.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform