473,473 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET Very Slow

BK
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? My final trials were
ALL on my local disk - Application & Data.

Thanks.
Nov 21 '05 #1
6 1597

"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
Nov 21 '05 #2

"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
Nov 21 '05 #3
I must concur. I had a little function that concatenated a series of
"numbers" into one big string - ie.: "0001 0004 2102 2394" etc. to send to
a database. Using string concatenation such as "a = a + b" was a gigantic
performance hit. Changed to StringBuilder and it now zips through tens of
thousands in a fraction of a second.

"Gerald Hernandez" <Cablewizard@sp*********@Yahoo.com> wrote in message
news:el**************@TK2MSFTNGP09.phx.gbl...

"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

Nov 21 '05 #4
"BK" <BK@discussions.microsoft.com> schrieb:
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? My final trials were
ALL on my local disk - Application & Data.


I think you'll have to show us some code...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
Code?

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 21 '05 #6
BK
I figured out the issues with some help. I was using legacy VB6 Code -
including Arrays, Redim Preserve and as you guys pointed out - string
comparisons and concatanations. However, it was the Array that was the
Killer. When I switched to ArrayList - I had comparable speeds with my VB6
program. Thanks for all your support.

Bobby.

"Dick Grier" wrote:
Code?

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: yawnmoth | last post by:
using the gethostbyname function seems to noticeably slow down pages. some of the comments in php.net's gethostbyname entry suggest using a version that caches the result, but those versions also...
8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
2
by: David | last post by:
Hi, We have an internal network of 3 users. Myself & one other currently have individual copies of the front-end MS Access forms and via our individual ODBC links we have used the: File > Get...
3
by: Jennyfer J Barco | last post by:
In my application I have a datagrid. The code calls a Stored procedure and brings like 200 records. I created a dataset and then a dataview to bind the results of the query to my grid using ...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
0
by: Pratchaya | last post by:
In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log long_query_time=1 #######
2
by: mezise | last post by:
Posted by Pratchaya: ------------------------------------------------------ MySQL Slow Log ERROR In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log
13
by: eighthman11 | last post by:
using Access 2003 and sql server version 8.0 Hey everyone. Created a text box where the user types in an Inventory number and it takes them to that inventory number on the contimuous form. The...
3
by: John | last post by:
Hi I have replaced an ms access app with its vb.net version at a client site. Now the clients keeps complaining about how slow the app response is. The complains they have are for example when...
10
by: penworthamnaynesh | last post by:
Does php slow your website down? This is what i would like to know.The reason is because my site is writtent 50% in html and 50% in php and is very slow at loading. And i cant tell wether php is...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.