Solved

Slow Vb.net program.

Posted on 2011-03-25
6
319 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

623 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