Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FLL Library & VFP6
Message
From
28/10/1998 22:50:27
 
 
To
28/10/1998 14:59:38
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149291
Message ID:
00152076
Views:
38
Hi again Dragan,
Would you believe it, I cant get Words() and Wordnum() to fail on big strings anymore. #$*#$%!
That embaressment aside, I've run some tests which are most enlightening and show that "roll your own" is better. And Fox 6 is no faster than Fox 5!!
I used a pentium II 233 MHz both VFP 5 and 6. The third method is basically your suggestion.
#DEFINE k_SEP CHR(32)

* get big string...
cData= FileToStr(GetFile())  && modify this to suit
set library to foxtools additive

* keeping the string intact....
t1= seconds()
cData= k_SEP + m.cData + k_SEP
FOR m.nn = 1 TO OCCURS(k_SEP, m.cData)-1
	nLo= AT(k_SEP, m.cData, m.nn)
	nHi= AT(k_SEP, m.cData, m.nn+1)
	cStr= SUBSTR(cData, m.nLo+1, m.nHi-m.nLo-1)
ENDFOR
tx= seconds() - m.t1
* Gave 30 secs

* using Words and Wordnum
t1= seconds()
FOR m.nn = 1 TO Words(m.cData, k_SEP)
	cStr= WordNum(cData, m.nn, k_SEP)
ENDFOR
ty= seconds() - m.t1
* Gave 45 secs (90 secs if no k_SEP used)

* cutting the string up
t1= seconds()
cStr= cData
DO WHILE LEN(m.cStr)>0
	nn= AT(k_SEP, m.cStr)
	cWord= LEFT(m.cStr, m.nn-1)
	cStr= SUBSTR(m.cStr, m.nn+1)
ENDDO
tz= seconds() - m.t1

MessageBox("AT+SUBSTR: " + ltrim(str(m.tx, 12,4)) ; && 30secs
	+ CHR(13) + "FOXTOOLS: " + ltrim(str(m.ty, 12,4)) ; && 45 secs
	+ CHR(13) + "AT+LEFT:" + ltrim(str(m.tz, 12,4)), ; && 16 secs
	48, "Results")
* => So Fox *is* faster than C
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform