Information générale
Catégorie:
Codage, syntaxe et commandes
>>>Your formula is a little slower than the other one because it uses GOMONTH twice. It also has 5 function calls vs. 4 in the other one.
>>>
>>>But, IMO, it is more readable/clear.
>>>
>>>Vlad
>>>
>>>>How about GOMONTH( DATE(),1 ) - DAY( GOMONTH( DATE(),1 ) )
>>>>I guess there's many ways to skin a cat.
>>
>>Actually, the code I use to get the last date of the month looks like
>>
>>ldLastDay = GOMONTH( DATE(),1 )
>>ldLastDay = ldLastDay - DAY( ldLastDay )
>
>Well, that'll take even longer since you're using 2 lines where only 1 line is necessary.
>
>But we continue to split hairs, simply for the sake of discussion.
Actually, I think there's an important point here. More lines of code on the foxpro level does not necessarily mean more code at the machine level. At one point that was believed to be true and at the sacrifice of readability, everyone started using IIF's instead of the IF ELSE constructs. To be honest, without testing the above, I really couldn't tell you, but I believed that the above would be faster because it only makes one function call.
I am certainly willing to be wrong, but I am curious to see some benchmarks.
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