Re: Displaying a large amount of data quickly (VB6)
- From: Tom Bates <noneedto@xxxxxxxx>
- Date: Thu, 14 Jul 2005 23:13:40 -0400
On Thu, 14 Jul 2005 13:19:53 -0700, "Karl E. Peterson" <karl@xxxxxxxx>
wrote:
>Tom Bates wrote:
>> It kinda looks like my suspicion might be correct - that anything
>> involving a loop of VB code would be too slow.
>
>I still think you're wrong about Join being faster. It's possible I suppose, but I'd
>sure be interested to know if that StringBuilder class I pointed you to couldn't do
>it quicker.
Ken, you piqued my interest, so I tried it out.
I added this in front of the timed sections:
datastr = "C:\Program files\Microsoft\Office\Office10\WinWOrd.exe"
ReDim bigarray(Loops) As String
For i = 1 To Loops
bigarray(i) = datastr
Next i
In the "standard append" section, I did this:
tmr.Reset
sTmp = Join(bigarray, vbCrLf)
d2 = tmr.Elapsed
In the "stringbuilder append" section, I changed it to this:
For i = 1 To Loops
sb.Append bigarray(i)
sb.Append vbCrLf
Next i
The results:
5000 loops: std append: 2 sb: 27
10000 loops: std append: 4 sb: 61
25000 loops: std append: 8 sb: 183
It kinda looks like the Join is, like, way faster.
What do you think? Did I run a valid test?
Tom
.
- Follow-Ups:
- Re: Displaying a large amount of data quickly (VB6)
- From: Karl E. Peterson
- Re: Displaying a large amount of data quickly (VB6)
- From: Tom Bates
- Re: Displaying a large amount of data quickly (VB6)
- References:
- Displaying a large amount of data quickly (VB6)
- From: Tom Bates
- Re: Displaying a large amount of data quickly (VB6)
- From: Tom Bates
- Re: Displaying a large amount of data quickly (VB6)
- From: Rick Rothstein
- Re: Displaying a large amount of data quickly (VB6)
- From: Tom Bates
- Re: Displaying a large amount of data quickly (VB6)
- From: Karl E. Peterson
- Displaying a large amount of data quickly (VB6)
- Prev by Date: Re: Displaying a large amount of data quickly (VB6)
- Next by Date: Re: Displaying a large amount of data quickly (VB6)
- Previous by thread: Re: Displaying a large amount of data quickly (VB6)
- Next by thread: Re: Displaying a large amount of data quickly (VB6)
- Index(es):