Hi Vince,
The string concatenation operation is typically quite slow. You are right that in TestComplete, it will work slower as compared to your application.
However, in your case, I'd suggest that you change the approach of writing data to the file you create.
Look at your code, you are using the aqFile.WriteToTextFile method:
...
For v = 1 to intSize
fData = ""
For u = 1 to 1024
fData = fData & Chr(32 + (rnd*223))
Next
Call aqFile.WriteToTextFile(f, fData, aqFile.ctANSI)
Next
...
To write data to a file, this method opens the file for writing, writes data to the file and then closes the file. These operations are time-consuming. Also, your test performs it in each step of the loop. I'd suggest changing the way you work with the file: open a file once, write data to it, close the file:
..
aqFile.Create(f)
' Open the file
Set textFile = aqFile.OpenTextFile(f, aqFile.faWrite, aqFile.ctANSI)
For v = 1 to intSize
' Generate string here
' fData = ...
Call textFile.Write(fData) ' Write data to the file
Next
textFile.Close ' Close the file
...
As far as I can see, this code dramatically reduces the test execution time on my computer. Generating a 1Mb-file now takes about 2 seconds.
Another area you can improve is generation of a string that contains 1024 characters. As far as I can see, you are interested in the string contents, so you can use VBScript's String function, for example:
fData = String(1024, "A")
Replacing a loop with this code reduces the file generation time to 0.3-0.4 seconds on my computer.