Click to See Complete Forum and Search --> : Speeding up the execution of an App
Hutty
Dec 22nd, 1999, 07:22 PM
I created an application using ADO. After first completion, the App was starting up in 3 seconds. I've since added several modules (.bas) and forms to the App in which there is a connection to the database. Now my App is starting up in 35 seconds. Is there a particular order that I should reference the different parts of my App in order to optimize speed and performance.
Thanks!
Hutty
Dec 22nd, 1999, 08:42 PM
I think I found where most of my problem is located, but not sure how to correct it. I have five modules (.bas) besides the code module for the form. On each module I'm opening and establishing a connection with the same database. The queries in each module are all from the same database. Just that the results go to different forms. Any ideas on best how to organize the setup of the App to optimize performance? I can remove the close connection and database from the form code, which would keep the database open I guess for other references.
Thanks!
MartinLiss
Dec 22nd, 1999, 10:57 PM
Make the connection to your database global in any one of the modules, and it will be available to everything else in your program. Another way to speed up loading is to remove as much code as possible from forms, and put it in a module. Also if you have a lot of strings hard-coded for MsgBoxes, etc., consider using a res file instead.
------------------
Marty
JHausmann
Dec 23rd, 1999, 03:34 AM
>There's a module for each form that opens a connection to the database.
Eeek. That's your problem all right. You need to define your database as a global (open it once on your main form) and open different _recordsets_ for each module. Each open instance of your database slows down the next.
[This message has been edited by JHausmann (edited 12-23-1999).]
MartinLiss
Dec 23rd, 1999, 05:21 AM
Clunietp: I could be wrong, but I don't believe it makes any difference to program speed where you store your variables. But I do know that storing code in forms increases program load time, and that was the subject of the original question.
------------------
Marty
Clunietp
Dec 23rd, 1999, 11:13 AM
Marty
I have always thought that it is less efficient to store variables, objects and methods at the global scope, as opposed to a form scope or just procedure scope. Is this the case?
Clunietp
Dec 23rd, 1999, 11:27 AM
Marty
If VB creates and destroys memory addresses for variables when they fall out of scope, then a variable declared at global scope would never be destroyed (and therefore still take up the memory). I suppose it would run faster, but would take up a lot more memory during app execution.
Any one else want to confirm this for us?
Thanks
Tom
Hutty
Dec 23rd, 1999, 11:53 AM
I hear you guys, I believe I'm doing things inefficient, but being a newbie it's what works for me. I'm retrieving recordsets from a database for six different forms. There's a module for each form that opens a connection to the database. On each form are listboxes(27-55) that stores the retrieved values. So pretty much every module looks pretty much the same. There's not much coding under the form_load event, althought there's a connection to the database, and a combo.additems from the database. I will explore the .res file as an option.
Thanks for your help!
[This message has been edited by Hutty (edited 12-23-1999).]
lengwai
Feb 16th, 2003, 09:05 PM
I am working on an application that might load about 500-1000 or more records and puts it into the screen.
I am currently using a ADO connection and i think, opening connection globally is good for me.
But executing the sql statement had been slow. Is there a way to enhance the performance? I was advice to use Extended List to do the database control. What do you guys think ?
Please Advice,
leng wai
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.