Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need a simple FLL
Message
 
 
À
21/09/2006 01:00:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01154766
Message ID:
01156815
Vues:
39
Thomas,

>As the "lcEscape = replicate( "%", lnLength / 2 * 3 )" is included as well as the calling overhead of the parameters I do believe the factor between both measurements will be different if you are repeating the call a couply of thousand times for smaller strings. If the source string length is more in the range of 50 - 200, Substr() should be faster.

VFP can allocate memory pretty darned fast. My box an average of 0.115 seconds for 10,000 iterations rather than one large sring. This ends up taking right at twice as long as doing one string 10,000 times longer.
declare integer EscapeX in C:\VFP8App\df_foxpro\dequote\release\dequote.dll  ;
   integer  nBufferLength, ;
   string   cInputBuffer, ;
   string  @cOutputBuffer

lcStr = strconv( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+", 15 )
? left( lcStr, 30 )
lnLength = len( lcStr )

lnStart = seconds()
for i = 1 to 10000
   lcEscape = replicate( "%", lnLength / 2 * 3 )
   EscapeX( lnLength, lcStr, @lcEscape )
endfor

lnStart = seconds() - lnStart
? lnStart, len( lcStr ), left( lcEscape, 40 )
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