Hi Christian,
>FOR EACH lcChar IN lcString
That'd be great indeed.
Can we do this task using your VFP2C library?
TIA
Cesar
>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
>
>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