• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 147
  • Last Modified:

Fixing a program that runs slow

I have a program that has a small access DB that slows down the program quite a bit.  The DB is setup with DAO.  To give an idea of the delay, when the program is first run, the time for it to load is about 8 seconds.  Is this a normal speed for including a DB or is there something I can add or modify to increase the speed?
0
Daron1
Asked:
Daron1
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
To have an initial connection to Access, 10 seconds is absolutely normal (if you have some splash screen, this will calm the user :-)

The most important is performance during normal operations, if here during switch of forms still same delay is given, then you have some code review to do.
0
 
wsh2Commented:
What is in your SQL SELECT statement?
If you can, simplify it to include only those fields you need. Eg.

SELECT [MyField1], [MyField2] FROM MyTable

rather than:

SELECT * FROM MyTable

What are the controls you are loading, and how are you loading them? Say you are using a recordset with data that is out of sequence and the Sorted property is set to True. With each Listbox.AddItem you do, a complete Listbox sort is going to take place, before you add the next Item. Set Listbox Sorted to False before doing your adds, and then reset it to True as soon as all the records are loaded. Or better yet, use the ORDERBY clause in your SQL statement to have the records in proper order. Eg.

SELECT [MyField1], [MyField2] FROM MyTable
ORDERBY [MyField1] ASC


0
 
GivenRandyCommented:
Yes, 10 to 15 seconds is normal.  What you might want to do is open the connection when you load the form and close it when you unload the form.  That way, if a user clicks a button (or something similar), he doesn't have to wait 10 to 15 seconds.

If you have a small section of code that needs optimizing, I can run it through my TrueTime -- a great tool that all VB developers should have if performance is a major concern (most programs are not overly concerned with performance, though).
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Daron1Author Commented:
GivenRandy:
Is there a place I can get TrueTime for a trial?  I've never used one, but I would like to see if this may be my problem.  The program is also hanging for a while when I try to exit the program.  I haven't made an .exe yet as it is still being developed.  If you think the DB may be a source of it I can provide you with the form it's used on to check if I am doing something I shouldn't be doing :).
Daron
0
 
GivenRandyCommented:
The TrueTime for VB is at:

http://www.numega.com/devcenter/tt.shtml

You can get a preview at:

http://www.numega.com/previews/previews.shtml

However, it is fairly expensive for individual use.  We bought the whole suite because it was more than worth it (performance was crucial).
0
 
Daron1Author Commented:
GivenRandy:
Is there a place I can get TrueTime for a trial?  I've never used one, but I would like to see if this may be my problem.  The program is also hanging for a while when I try to exit the program.  I haven't made an .exe yet as it is still being developed.  If you think the DB may be a source of it I can provide you with the form it's used on to check if I am doing something I shouldn't be doing :).
Daron
0
 
GivenRandyCommented:
Were you able to check the above URLs?
0
 
Daron1Author Commented:
I don't know why it put my comments twice.  I looked at the pages, and it looks like it would be a great thing to have, however it is more than I would like to spend for the projects I work on.  This is the first time performance has been a problem for me.  If you are able to check code on a single MDI child, I'll send it to you.
0
 
GivenRandyCommented:
Of course, it depends on the code, but I should be able to do it.  Can you give me an idea what you would like to happen.  For example, is it just the startup time?  Is it when a user does some particular action?

You can email to: GivenRandy@aol.com
0
 
daronCommented:
The process seems to be slow on startup and ending.  Once the information is loaded (such as DB info), it doesn't seem to have any problem.  I think the only control I've added since it has been slow is the Access DB, which is actually called from two different forms.  One inprovement may be to move the DB to a module where it is instantiated only once for both forms.  But this is only part, as it was slow before I added the second form.
So in a nutshell, the slowest parts is on startup and on ending the program.  The code for the form is pretty small, only a few functions.  So it may be clear to you as to what may need to be improved.
0
 
Daron1Author Commented:
Comment accepted as answer
0
 
Daron1Author Commented:
I checked the task list when the program started to run slow, but didn't find any other instances of the database or VB program.  I believe it is a battle of resources for a variety of unreleated issues.  I am sure that the problem is not associated with the access DB.  It was indeed a great learning device though.  Thanks.  Daron
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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