Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CHRTRAN and remove characters
Message
De
14/10/2004 13:12:51
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00950654
Message ID:
00951470
Vues:
7
>Fabio,
>
>>Fast is a relative concept.
>>A O(n)*1s or O(n)*1ms are two different thing.
>
>Yes, if I had code that took one second per n I wouldn't run very large values of n through the code. That should be pretty obivious to everyone.
>
>>>CHRTRAN() is already fast enough under the LEN(param2)=LEN(param3) condition, so no other alternate code is required. VFP has O(n) performance when doing character for character substitution.
>
>
>lcStr = "abcdefghijklmnop"
>
>for i = 1 to 6
>   lcStrTran = replicate( lcStr, 10 ^ i )
>   ltStart = seconds()
>   lcX = chrtran( lcStrTran, lcStr, lcStr )
>   ltStart = seconds() - ltStart
>   ? i, len( lcStrTran ), ltStart
>endfor
>
>
>Even on this cruddy 2gh Celeron box VFP does 16 million character translations and puts it in the output buffer in 0.73 seconds so that makes it 0.045625 microseconds per n.
>
>So, tell us all how right to left would make it any faster, much lest a thousand times faster... please we are all curious.

VFP CHRTRAN, when don't remove character, don't use a O(n)
( because this not exist ), but it use a O(n*m) program.

Any developer, with a little backgroud, known that this task can to be make
in O((n+m)*Log(min(n,m))).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform