Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Textmerge to file vs string concatenation
Message
From
23/07/2003 07:49:25
Dorin Vasilescu
ALL Trans Romania
Arad, Romania
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Textmerge to file vs string concatenation
Miscellaneous
Thread ID:
00812707
Message ID:
00812707
Views:
44
I've just run this code and I found that textmerge to file is 40 times faster than string concatenation using memory variable. It is true or I miss something?
#define _loops 20000
CLEAR 
? _loops, 'loops'
_t=SECONDS()
xx=''
FOR i=1 to _loops
	xx=xx+'123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
NEXT
?'String concatenation:',SECONDS()-_t

_t=SECONDS()
SET TEXTMERGE TO memvar xx NOSHOW
FOR i=1 to _loops
	\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
NEXT
SET TEXTMERGE TO
?'Textmerge to memvar:',SECONDS()-_t


_t=SECONDS()
SET TEXTMERGE TO xx.txt NOSHOW
FOR i=1 to _loops
	\\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
NEXT
SET TEXTMERGE TO
xx=FILETOSTR('xx.txt')
?'Textmerge to file + FILETOSTR()',SECONDS()-_t
ERASE xx.txt
Next
Reply
Map
View

Click here to load this message in the networking platform