Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Extract a Word
Message
De
12/07/2001 08:54:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00529297
Message ID:
00529629
Vues:
14
>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.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform