Solved

Slow Vb.net program.

Posted on 2011-03-25
6
316 Views
Last Modified: 2012-05-11
Hi All

I made a billing system that run thought about 2000 records aday, it used to be really fast as in about 40 in one second but i change a few minor thing and now it's mega slow as in one every 2.5 seconds.

Anyidea how to find out which part of the code is slowing it down.... I know could do it be "trial and error" i.e. testing one bit of the code at a time.

All I add was a case statement with 6 cases... this should slow it down that much should it?

Cheers

Matt
0
Comment
Question by:Matb396
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:Casirus
ID: 35214035
well from my own experience if it is pulling the info from a database and then running it through Case statements it can slow down an app greatly i ended up having to go deeper into multi-threading to fix my problem

so what you could do is
1. Multi-Thread the Case selection code
2. Remove the Case Code
3. Find a work around for the case select by using another form of statement like an IF statement yes it may be a low end solution but it can work thought there is a chance it would still run slow

i hope my input helps in some way

D.L.H.
0
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35215288
Hi,

First you will have to remove the Case and try it, so you can be sure that really is the Case that it is slowing down the application.

If after remove it, your application run faster again, you have to consider make the CASE inside your SQL Select Statement depending on what DB are you using.

But, after remot it, the application is still slow, you will have to check your entire process or  DB Connection problems.
0
 

Author Comment

by:Matb396
ID: 35215320
The case statement is on some CSV data, so can't be done in the sql.

Is 6 IF statement fast then one case with 6 cases?

Matt
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 28

Accepted Solution

by:
Ryan McCauley earned 500 total points
ID: 35215781
What happens if you put the code back the way it was before you "changed some things" - is it quick again? If it is, then it's the code you added - if it's not, maybe the database has grown or changed and needs an index to speed things up again.

How are you processing your data - are you fetching the rows from the database one by one, or are you fetching all the rows at once from the database and then operating on them one at a time in your application? The second way is most likely faster - it's fewer calls to the database, and most databases are best operating on sets of rows and returning them all, instead of doing tons of one-off lookups (they will return 100 rows much more quickly than they will return 100 different rows one at a time).

If all you've changed is a few things and now it's slow, look at what you've changed. Have you added any loops that are unnecessary (or contain unnecessary steps)? If you step through your code, are there some steps that seem to take a long time? Are you making any calls to other systems that take a second or two to complete, and are you making those calls for every row?
0
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35215878
In theory the select case should be faster, since it's a lookup table.
0
 

Author Closing Comment

by:Matb396
ID: 35215986
yes there was a problem with the indexing in the database.

After re-indexing it i run much fast!

cheers

matt
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Prime numbers are natural numbers greater than 1 that have only two divisors (the number itself and 1). By “divisible” we mean dividend % divisor = 0 (% indicates MODULAR. It gives the reminder of a division operation). We’ll follow multiple approac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question