|
-
Apr 3rd, 2000, 03:36 AM
#1
Thread Starter
New Member
Can someone give me some direction on figuring out how to speed up a VB 5.0 application?
I have an app. that is running way too slow and I want to identify where things are really slow. Hoping to key in a few areas rather than look at the whole project.
Is there a method that someone else has used successfully?
Thanks
Steve
-
Apr 3rd, 2000, 03:40 AM
#2
transcendental analytic
I think you'd better tell a bit more about your app, and what it does.
-
Apr 3rd, 2000, 03:47 AM
#3
Thread Starter
New Member
The app is a front end to a few databases. The app retrieves data from a mainframe, from a sybase server, from a MS Access DB and displays it on several forms.
The app uses tree structures, display grids for collections & icon lists. It also uses an out of process server for the retrieval of information from the different data sources. A DLL is also used for the formatting and printing of some data.
Hope this gives some insight into the application.
Thanks for the response.
Steve
-
Apr 3rd, 2000, 12:54 PM
#4
transcendental analytic
OK, That can be hard to do any analysis on but you can test the performance of all your code with a timer to get find the problem. Here's two examples: The second is more exact while the first can be used on slow procedures:
Code:
atimer = Timer
'code goes here
MsgBox (Timer - atimer) * 1000 & " ms"
Code:
atimer = Timer
For n = 1 To 100
'code goes here
Next n
MsgBox (Timer - atimer) * 10 & " ms"
-
Apr 4th, 2000, 01:42 PM
#5
New Member
Hello Steve,
About your optimising the code - I did try out, some weeks ago, some methods on optimising my VB code. I had found out 2 tools for VB optimising -
1) Project Analyzer (just search for this in altavista.com)
2) VB Compress Pro - a product of Whippleware (www.whippleware.com)
Project Analyzer (PA) does not optimise your code automatically, you will have to do it manually (I think). The PA will show all the errors in your code and will suggest methods for optimisation. It optimises the dead variables, dead procedures, procedures without code and many more. One additional feature of PA as compared to VB Compress Pro is that PA also shows in which all procedures error handlers are missing. It is better you download the evaluation copy of the 2 and try out your project. You will also get a tutorial material with the PA. PA is much more user friendly than the VB Comp Pro.
It is said that the VB Comp Pro optimises the code automatically but it is not as user friendly as the PA. You also get lots of statistics reports thru' the PA.
I preferred the PA for my project 'coz they even showed the missing error handlers.
I think this should answer your question. Please reply if this was any use to you.
Anna ([email protected])
-
Apr 5th, 2000, 07:35 AM
#6
Addicted Member
Without looking at your code it can be pretty hard to give specifics on what optimizations you can make, but here are some general tips you can use:
Remember that each period (.) in an object reference needs to be resolved by your program (ie. the dots in frmMain.Textbox1.Text = "Hi"). If you reference the value of something like Textbox1.Text in several places in your code, assign the value to a variable and reference that variable for better performance.
Variants are generally slower than specific data types (ie. integer, long, etc)
For Databases, You can use a FOR Loop to iterate through the recordset instead of the While Not EOF for better performance. Be careful to only use this if you are sure that only one user will be accessing this data at a time or you may get inaccurate results if records are added while the For Loop is running.
Only return/refresh full recordsets when necessary. Don't return a record set and search the recordset for a specific entry if you can just get the exact record using the proper SQL query.
There are a lot of other optimizations that can be made, but these are a few I could think of right off. The Access-VB-SQL Advisor Magazine had a good article on Database code optimization a while back. You might be able to find it on their website http://www.advisor.com.
Hope this helps some.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|