Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A=b therefore b=a Rushmore? You're a crappy coder
Message
De
19/06/2021 12:06:20
Walter Meester
HoogkarspelPays-Bas
 
 
À
19/06/2021 11:24:15
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01681413
Message ID:
01681416
Vues:
59
>I went to work for a member of my Toronto FoxPro User Group. Another crappy code that thinks he's a genius.
>
>He asked me why one of his routines was slow. I pointed out innocently and with a willingness to be helpful that Rushmore uses the expression on the left to decide what indexes to use. He said I was wrong. A=B and B=A so therefore Rushmore must optimize the expression whether it was written as LOCATE FOR Upper(fieldname) = "washout walter" or LOCATE FOR "washout walter" = UPPER(fieldname). When I proved it by the manual and by scientific demonstration, he, like our stupidest members got mad at me. Idiots just gotta idiot.


This is not true in VFP9 (I remember something like that in a previous version, but I can't remember the details anymore and haven't got older VFP versions installed)

Very quick test in VFP9
nSec = SECONDS()
FOR nT = 1 TO 1000
	LOCATE FOR UPPER(Field) = 'SOMEVALUE'
ENDFOR
? SECONDS() - nSec

nSec = SECONDS()
FOR nT = 1 TO 1000
	LOCATE FOR 'SOMEVALUE' = UPPER(Field)
ENDFOR

? SECONDS() - nSec
Both ran in approx 40 ms, using the same index. Removing the index, the time needed is tenfold for both

It might be the case in VFP6, but not in VFP9.

Walter,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform