Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

Slow Vb.net program.

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
Matb396
Asked:
Matb396
1 Solution
 
CasirusCommented:
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
 
gamarrojgqCommented:
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
 
Matb396Author Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Ryan McCauleyCommented:
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
 
gamarrojgqCommented:
In theory the select case should be faster, since it's a lookup table.
0
 
Matb396Author Commented:
yes there was a problem with the indexing in the database.

After re-indexing it i run much fast!

cheers

matt
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now