Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need a simple FLL
Message
De
19/09/2006 16:55:56
 
 
À
19/09/2006 16:13:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01154766
Message ID:
01155273
Vues:
33
Hello,

Your posted code takes 0.3-0.4 seconds on my PC too, though it's an Athlon64 3200 + (2.0Ghz). The FLL code takes 0.005 seconds, about 60-80 times faster.
Writing an efficient algorithm with pure FoxPro code that has to deal with each character in a string is just not possible.
The SUBSTR function is horribly ineffecient because of paramter by value semantics (the bigger the string parameter to SUBSTR the slower it gets).

A nice addition of the language would be a special FOR EACH loop, e.g.
lcString = FILETOSTR(GETFILE())
FOR EACH lcChar IN lcString
&& do something with the character
ENDFOR
this would make it possible to write more efficient character based algorithms, but against C code this would still perform loosy.

Additionally you allocate 2 blocks of memory in your code, since HeapAlloc/HeapFree can only be called by one thread in a process at a time (to avoid heap corruption) this would create a bottleneck in a multithreaded webserver environment (one thread blocks the others) degrading performance even more.

Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform