Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need a simple FLL
Message
From
19/09/2006 16:55:56
 
 
To
19/09/2006 16:13:10
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01154766
Message ID:
01155273
Views:
29
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform