Information générale
Catégorie:
Codage, syntaxe et commandes
Naomi:
I was originally told of the difference in speed 10 years ago. Per your request, I just now tested them, and confirmed the difference. I ran this code:
**********************************************
@ 8, 10 say TIME()
FOR x = 1 TO 100000000
a = IIF(x%2=0, "Even", "Odd")
ENDFOR
@ 10, 10 say TIME()
@ 15, 10 say TIME()
FOR x = 1 TO 100000000
IF x%2=0
a = "Even"
ELSE
a = "Odd"
ENDIF
ENDFOR
@ 17, 10 say TIME()
**********************************************
IIF took 1:12, and IF...ELSE...ENDIF took 1:23.
Then, I ran the IF...ELSE...ENDIF first, and IIF second. IF...ELSE...ENDIF took 1:26 and IIF took 1:13.
So, IIF appears to be about 13-15% faster than IF...ELSE...ENDIF.
Jerry
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement