Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C++ can speed up native VFP strings command ?
Message
 
 
À
20/11/2003 12:25:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00851950
Message ID:
00852187
Vues:
8
Fabio,

Your two requests of the functions are not exactly equivalent.

occurs() must always scan the entire string to find and count the total number of occurances in the target string.

at(,,n) can stop its scan of the string as soon as it finds the Nth occurance.

If you are unhappy with the performance of any given VFP string function, there are two articles on my website showing how you can call C++ code from VFP. Both examples perform the task between 2 times as fast as VFP and several orders of magnitude faster than VFP.

>Normally one believes that the string functions of VFP are much fast;
>this is correct, but it is not a general rule.
>In this example, it comes used OCCURS() and AT in order to obtain the same information:
>One string appears more than N times in an other string.
>
>If the routines of AT and OCCURS they were both written best,
>time for execute the request would have to be practically identical.
>
>Instead the difference is of 10x 15x (1000% - 1500%)
>
>Example code for N=19
>
>sString = ''
>FOR J=1 TO 20
>sString = m.sString +','+REPLICATE('a',100)
>NEXT
>? 'Lenght = ',LEN(m.sString)
>t1=SECONDS()
>FOR k=1 TO 50000
>  =OCCURS(",",m.sString)>19
>NEXT
>? "OCCURS",SECONDS()-t1
>t1=SECONDS()
>FOR k=1 TO 50000
>  =AT(",",m.sString,20)>0
>NEXT
>? "AT",SECONDS()-t1
>
>
>Then, exist native VFP command that C++ can speedup.
>
>Fabio
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform