Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VB x C# with StringBuilder
Message
 
To
17/05/2002 06:52:53
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00658061
Message ID:
00658075
Views:
15
Hi Claudio,

The only thing I would change in the VB .NET code is
>Dim i
'and make it
Dim i As Integer
This way the object "i" will not be boxed and unboxed everytime it is accessed. Try it now... the results should be the same.

hth,
Kamal


>Hi, everybody.
>
>Some months ago, I´ve made some testings to look at the performance of VFP 7 and VB 6 on the string concatenation... by that time, with some research, I discovered about the "dynamic memory allocation" problem of VB 6.
>
>Now, I just teste such thing, but with VFP, C# and VB.NET. As I was reading, VS.NET provides the StringBuilder class, in order to speedup this sort of thing. Well, I´ve run this code in C#:
>
>
>StringBuilder SB = new StringBuilder();
>
>int i=1;
>
>while (i != 30000)
>{
>SB.Append("Hi"+i.ToString());
>SB.Append(" blah blahblah blahblah blahblah blahblah blahblah blah ");
>i++;
>}
>
>
>and in VB:
>
>
>Dim SB = New System.Text.StringBuilder()
>
>Dim i
>
>For i = 1 To 30000
>
>  SB.Append("Hi" + i.ToString())
>  SB.Append(" blah blahblah blahblah blahblah blahblah blahblah blah ")
>Next
>
>
>As I´m not a VBer, and I´m just starting study C#, I don´t know if that´s the correct way of doing things... anyway, for what people are saying, such code must have similar performance... but, that wasn´t what I saw.
>
>Any comments?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform