Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memory Pre-Allocation Trick?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00721182
Message ID:
00722533
Vues:
37
Hi David,

>I hope I didn't imply that VFP was totally as fast as C++

You didn't. We both know how fast C++ is. *s* My intention was to point out that even though VFP got a lot faster over time, it can't beat a C++ program regarding string handling.

>I really don't know why you'd ever do 15,360 dual memory allocations, ie once for the result of the replicate() and then concatenate it to the other string.

I've seen this a lot when generating XML/HTML. As you pointed out in another message, you can speed this up by assigning parts to intermediate strings. However, if you had 15,000 records, you would end up with as many memory allocations.

>Although I don't know, stuff() might map directly to memcpy() in some cases.

But the problem is again memory allocation. STUFF() doesn't stuff things into the first parameter, but returns a *new* string as a result. I did a quick test. There's no optimization in VFP if you assign the result to the same string that you passed as the first parameter.

In any case, I just wanted to give one more alternative to building string in VFP that doesn't rely on file operations and is still a viable way for VFP developers without going the C++ DLL route. *s*

Christof
--
Christof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform