Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String Concat and XML
Message
From
04/04/2002 03:24:21
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00640419
Message ID:
00640734
Views:
16
Steve,
I didn't mean VFP concat slower than DOM or VB. I only said lowlevel manipulation beats VFP in itself. IOW go with VFP but test with lowlevel vs traditional concat. Also VFP6 and 7 versions tend to prove me wrong as traditional way vs lowlevel gap is greatly reduced. Now it's very hard to show which one is faster. ie (a sample test that doesn't prove anything but might give idea):
function ConcatTest
LPARAMETERS BASELEN
#define TESTSIZE 65000
DIMENSION aDummy[TESTSIZE] && Create arrays
aDummy = REPLICATE("A",BASELEN) && Set all elements
nStart = seconds()
lcString = ""
FOR ix = 1 to TESTSIZE
	lcString = lcString +  aDummy[ix]
ENDFOR
? seconds() - nStart, "Length of string :", len(lcString)

nStart = seconds()
handle=fcreate("temp.txt")
FOR ix = 1 to TESTSIZE
	=fwrite(handle, aDummy[ix])
ENDFOR
lnSize = fseek(handle,0,2)
=fseek(handle,0,0)
lcString=fread(handle,lnSize)
=fclose(handle)
ERASE ('temp.txt')
? seconds() - nStart, "Length of string :", len(lcString)
With ConcatTest(1) traditional beats lowlevel or almost there is no winner, however as you increase value the winner is lowlevel and as it increases to 10,20,30,100,200 speed difference is enormous. Lowlevel timing is almost static.
Cetin

>I am trying to keep everything in memory, I am afraid that I will suffer a speed penalty shuffling things to disk every time.
>
>All this time I never assumed VFP's concat to be slow. OK then, time to build with the DOM....
>
>>
>>String concat is slow in VFP too. I'd write to a file and read it at once.
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform