Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining whether a control exists.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00453834
Message ID:
00454507
Vues:
33
>Nadya,
>
>Try this one and see which one is faster.
>
>
>LOCAL i, lnSec
>lnSec=seconds()
>
>for i=1 to 100000
>   if type('oJC.Name')='C'
>   endif
>next
>
>?seconds()-lnSec
>lnSec=seconds()
>
>for i=1 to 100000
>  if vartype(oJC.Name)='C'
>  endif
>next
>?seconds()-lnSec
>
>
>
>BTW, Make sure that oJC does not exist. So how much faster is VarType() now?
>Speed isn't everything you see .,,

Jim,

I'm not arguing about the approach. I'm just telling, that if you want to check Object existence (which is not the part of another object), you can use vartype and it would be faster.

In one of my colleague code I noticed something like:
scan for !Posted
* bunch of code
if type('oPost')<>'O'
oPost=createobject('Post')
endif
* etc.
endscan

Obviously vartype would be faster in this case, though speed benefit is about 0.5 sec. for 10000 records.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform