Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extract a Word
Message
 
To
12/07/2001 08:54:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00529297
Message ID:
00529659
Views:
9
Hilmar,
Thanks for the test and the test code! I guess it's faster since the whole thing is in memory with alines() ..
>>alines() is simpler and, if you believe the Microsoft documentation, should be faster...
>
>That is a big "if"... However, you are right. I believed it would take alines() too long to copy the text into the array, but the following test program confirms that alines() is, indeed, faster that mline(), even when using the variable _mline.
>
>
>clear
>
>lcString = ""
>for i = 1 to 1000
>	lcString = lcString + chr(13) + chr(10) + alltrim(str(i))
>next
>
>* mline()
>lnStart = seconds()
>for i = 1 to memlines(lcString)
>	discard(mline(lcString, i))
>next
>? "mline():", seconds() - lnStart
>
>* mline() + _mline
>lnStart = seconds()
>_mline = 0
>for i = 1 to memlines(lcString)
>	discard(mline(lcString, 1, _mline))
>next
>? "mline() + _mline:", seconds() - lnStart
>
>* alines()
>lnStart = seconds()
>for i = 1 to alines(MyArray, lcString)
>	discard(MyArray(i))
>next
>? "alines():", seconds() - lnStart
>
>FUNCTION Discard(lcString)
>return .T.
>
Previous
Reply
Map
View

Click here to load this message in the networking platform