"David Browne" <davidbaxterbrowne no potted
me**@hotmail.com> wrote in
message news:uV*************@TK2MSFTNGP14.phx.gbl...
"BK" <BK@discussions.microsoft.com> wrote in message
news:05**********************************@microsof t.com...I was writing an application VB.NET that inputs a TEXT file (about 5 MB).
The reading code took for ever (20+ minutes) to read in 120,000 Lines.
I had
to quit coding in .NET and had to go back to VB6 to deliver the results.
Takes about 10 seconds with VB6. 99% identical code.
I must be doing something wrong. What is happening?
"99% identical code." is what's happening. VB.NET has very different
performance characteristics than VB6. Just because VB.NET supports much
of the same syntax for backwards compatibility, that doesn't mean that the
right way to code a particular program in VB6 and VB.NET is the same.
When you code things "the VB6 way" you may well not get very good
performance.
If you post a simple repro, someone may be able to suggest a better way to
do it in .NET.
David
In addition to David's comments...
Given your description, I bet you are using a bunch of Strings, correct?
Are you doing a lot of concatentating and other types of manipulation?
If so, this is most likely your problem. You will need to ditch the String's
in favor of StringBuilder.
In my experience, using Strings in the same manner as VB6 can result in HUGE
performance issues. But after rewriting the code to utilize StringBuilder I
found much code now runs measurably faster than VB6. When "upgrading" VB6
code, sadly there is quite a bit of rewriting required for similar reasons.
Gerald