Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which Is Better???
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00458477
Message ID:
00458489
Vues:
16
>>I am updating a series of PRG's to optimize them for speed and to get them ready to convert into classes.
>>
>>I am finding statement's like:
>>
>>
>>   replace all cpt_code with h->new_cpt for;
>>      h->new_cpt<>space(10).and..not.subs(h->new_cpt,1,1)$'QHZ'
>>

>>
>>My updated version is:
>>
>>
>>   REPLACE ALL Cpt_Code WITH Cdm.new_cpt;
>>     FOR NOT EMPTY(Cdm.new_cpt) AND NOT LEFT(Cdm.new_cpt,1) $ "QHZ"
>>

>>
>>
>>In the first example, you can see where I replaced the '<>space(10)' with 'NOT EMPTY()' and
the 'SUBSTR()' with 'LEFT()'
>>
>>
>>So my question is, in a program with many of these REPLACE statements, what kind of speed advantages will I see with these changes?
>
>You may actually see a performance hit. Using "<> space(10)" is optimizable where the Empty() function is not. Also the $ operator is not optimzable. So you have made a partially optimable (because 1 side of the AND is and 1 side is not) FOR clause not optimzable at all.
>
>FWIW, to make the statement fully optimzable, go back to the space(10) option and change the $ code to:
>NOT (Cdm.new_cpt = "Q" OR Cdm.new_cpt = "H" OR Cdm.new_cpt = "Z")
>If you choices are limited to only three, this may help with speed. Otherwise, partially optimzable is better than none.
>
>HTH.
You can also use Inlist() function, which is Rushmore optimizable. Note, also, that this syntax would work only if SET EXACT OFF and SET ANSI OFF (partial string compare).
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform