Feature Summary
» 20+
categories and 200+ tips
pdGuideBook contains the most comprehensive database of performance improvement techniques ever compiled! These are not just one line tips - each performance item is explained in detail and
most include impact timings, risk assessments, and samples.
» Example
Applications
Performance tips include example applications - which demonstrate various performance techniques and allow you to view the results first hand.
» Integrated,
customizable VB IDE pdCodeScanner
The pdCodeScanner is a VB Addin which will scan your project code for possible optimization improvements.
Choose which categories and individual tips you want to the pdCodeScanner to look for. The
settings are maintained at a project level.
» Interactively
view scan result and jump to identified code
Results are viewable in the pdGuideBook - which can be automatically invoked at the completion of the scan.
When viewing scan results, a single click can take directly to the
associated code in your project.
» pdTimer
component comparison tool
The pdTimer is a powerful comparison tool to measure and report differences between related procedures. This is the perfect tool to test your own optimization questions and ideas.
Only 2 lines of code for each procedure being tested. Only 1 line of code to display the results.
Licensed users are free to use the pdTimer tool in their own applications and install on end-use machines.
pdGuideBook Table of Contents
Category: ReadMe First
> How to use the
pdGuideBook
> Introduction to
Optimization
> Performance Timings
> References,
Acknowledgements and Credits
> Table of Contents:
Category - Item List
Category: General
Discussions
> !READ ME FIRST -
SECTION SUMMARY
> Optimization 101
> Step 1 - Make it
work, then make it fast
> Step 2 - Simple, safe
optimizations first.
> Step 3 - Use a code
profiler
> Step 4 - Eliminate
unnecessary code execution
> Step 5 - Evaluate
high use code and algorithms.
> Step 6 - Difficult
and/or higher risk optimizations
Category: Project
Compile Options
> !READ ME FIRST -
SECTION SUMMARY
> Allow Unrounded
Floating Point Operations - Advanced Compiler Optimization Options
> Assume No Aliasing -
Advanced Compiler Optimization Options
> Favor Pentium Pro
(tm) - Native Code Compile Option
> Remove Array Bound
Checks - Advanced Compiler Optimization Options
> Remove Floating Point
Error Checks - Advanced Compiler Optimization Options
> Remove Integer
Overflow Checks - Advanced Compiler Optimization Options
> Remove Safe Pentium™
FDIV Checks - Advanced Compiler Optimization Options
> Compile to Native
Code versus P-Code
> Setting Base
Addresses for In-Process Components
> All Advanced Compiler
Optimization Options (summary)
Category: Forms and
Controls
> !READ ME FIRST -
SECTION SUMMARY
> Control arrays -
faster or not?
> Call cmdOK_Click is
faster than cmdOK_Click.Value = True
> Enable/Disable forms
and controls via API call
> Finding selected
items in a MultiSelect listbox
> For non-graphics
applications, set ClipControls = False and AutoRedraw = False
> Lock window and/or
controls from updating during multiple operations
> Set Form = Nothing
when no longer needed
> Use Form Move method
instead of setting Form position properties
> Use windowless
controls if possible for faster form loads and paints
> Append strings to
textbox controls (fast!)
> Optimized loading of
Treeview and ListView items
> Share picture
resources among controls and/or forms
> Which is faster -
Image control or PictureBox control?
> Graphic applications,
setting ClipControls and AutoRedraw
> Hide frequently used
forms instead of unloading
> Use lowest color
resolution acceptable for graphic images (plus which graphic format)
Category: ADO Database
Access (Jet)
> !READ ME FIRST -
SECTION SUMMARY
> Setting the Lock Type
for recordsets
> Choosing the cursor
type for database reads
> Avoid using Select *
in an SQL expression
> Get data from a
recordset using the GetRows method - very fast!
> GetString method for
recordset is convenient, but slower than code
> Stored Procedures
provide the fastest database reads
> The fastest way to
access the Fields collection of a Recordset
> The fastest way to
update recordset data (via .Update)
> Avoid Stored
Procedures when adding records to the database
> Cache field
properties for faster access (reading)
> Microsoft Access
Databases get fragmented with use
> The fastest way to
add records to a recordset (via .AddNew)
> Editing database
records -what is the faster method?
> Use the adUseServer
Cursor location for faster updates
Category: DAO Database
Access (Jet)
> !READ ME FIRST -
SECTION SUMMARY
> Avoid using embedded
expressions in SQL queries
> Effects of opening
and closing recordsets repeatedly against linked Microsoft Jet tables
> Setting recordset
options for adding new records
> Setting recordset
options for updating records
> Compact Access
database for improved performance
> The fastest way to
access the Fields collection of a Recordset
> Use stored procedures
to edit records
> Use transactions (BeginTrans
... CommitTrans) when editing or adding Records
> Setting recordset
options for reading records
> Use Seek to navigate
a recordset
Category: SQL and DB
Tables
> !READ ME FIRST -
SECTION SUMMARY
> Use of the HAVING
clause in an SQL query.
> Inserts and Updates
too slow?
> Optimizing multiple
ANDs in WHERE clause conditions
> Optimizing multiple
ORs in WHERE clause conditions
> Pros and Cons of
table indexes.
Category: File System
Access
> !READ ME FIRST -
SECTION SUMMARY
> Native VB File Read
is faster than the FileSystemObject (VBScript)
> Native VB File Write
is faster than the FileSystemObject (VBScript)
> Binary Put is faster
than Print method
> Random Access beats
Binary Get for arrays
> Binary Get faster
than the Input function
> Fastest method of
searching a drive for a file
> Writing user defined
type arrays to disk - fastest method
Category: String
Handling
> !READ ME FIRST -
SECTION SUMMARY
> String Concatenation
using the + Operator (use & instead)
> Use StrComp for case
insensitive string comparisons
> Using the VB string
functions that return a variant rather than a string
> Avoid implicit
Unicode - Ansi string conversions (Use ChrW$ and AscW$)
> Avoid using fixed
length strings
> Byte by byte
iteration of a string using a Byte Array
> Emptying a string
(null string assignment)
> Evaluating the left
most character of a string ( Left$(sTemp, 1) vs AscW$)
> Testing a single
character against a list of characters
> Testing a string to
see if it is empty (null string comparison)
> Use VB Intrinsic
string constants when possible.
> String Concatenation
vs. String Insertion
Category: Arrays
> !READ ME FIRST -
SECTION SUMMARY
> Repeatedly accessing
an array item's value directly
> Scanning a
two-dimensional array by row first and column second
> Using For Each ...
Next on variant arrays - very slow!
> Using two-dimensional
arrays versus one-dimensional arrays
> Writing and reading
arrays to and from the hard drive
> Copying a block of
data from one array to another of the same type
> Fast way to test if
an array is initialized (no error handling required)
> Searching Arrays with
a For ... Next loop (serial search)
Category: Math
> !READ ME FIRST -
SECTION SUMMARY
> Avoid using the Val
function for converting strings to numbers
> Division vs
Multiplication
> Raising to a power
using the ^ operator is slow!
> Use the \ (integer
division) versus / (floating point division) for integer division
> Calculating function
results repeatedly for the same input values
Category: General
Language
> !READ ME FIRST -
SECTION SUMMARY
> Optimizing If/ElseIf
and/or Select/Case statement.
> Quick way to invert
the value of a Boolean variable
> Correctly using a
With/With End block for maximum performance
> For-Next versus
Do-Loop, which is faster?
> In-Line code is
faster than procedure calls
> Use a Long as the
controlling variable within a loop
> Watch out for
multiple "And" conditions within a single If statement
> Store object
properties in a variable for repeated use
> Using a GoSub....Return
statement in a native-code compiled application will slow you down
> Using the Visual
Basic Choose function
> Using the Visual
Basic IIf function
Category: Variables And
Constants
> !READ ME FIRST -
SECTION SUMMARY
> The scoop on variable
scope
> Use constants to
reduce application size
> Avoid using
unnecessary temporary variables in functions
> Missing Option
Explicit statement
> Type your literal
constants for improved performance
> Using constants
declared with a missing or wrong type
> Accidentally
declaring a variant from an incorrect multi-type declaration statement or
a missing type specification
> Performance penalty
for using Property Let/Get/Set Procedures
> Be sure to specify
the return type on a function declaration
> Explicitly declaring
variables or function return types as variant
Category: Objects and
Collections
> !READ ME FIRST -
SECTION SUMMARY
> Using the Dim As New
syntax to declare and instantiate an object creates overhead
> Removing all items
from a Collection in one line of code
> Accessing an item in
a Collection using a numerical index is slow
> Using the generic
Object variable type forces late binding
> Dictionary Object not
necessarily faster than Collection Object
> Use For Each / Next
to iterate through the objects in a collection
Category: Graphics
(drawing)
> !READ ME FIRST -
SECTION SUMMARY
> VB Circle method is
just as fast as Ellipse API
> Improve line drawing
using LineTo API call
> Minimize brush color
changes for improved drawing speed
> Use Pset for a single
point, Line for multiples
> Drawing a rectangle
is faster via Rectangle API call
> Print Text on a Form
via the API TextOut
> The effects of the
Form's AutoRedraw property on graphics
Category: Components
(DLL/xEXE/OCX)
> !READ ME FIRST -
SECTION SUMMARY
> Setting Base
Addresses for In-Process Components
> In-Process versus
Out-of-Process
> Minimize the dots
> Passing parameters
(marshalling)
Category: MTS/COM+
> !READ ME FIRST -
SECTION SUMMARY
> Acquire resources as
late as possible, then release as soon as possible
> Avoid small round
trips (like properties) to COM+ objects
> ByRef or ByVal? ByVal
is normally faster!
> Consolidate COM
Component DLLs
> Correct compiler
settings for COM+ VB DLLs
> It is ok to use New
in many cases
Category: WebClasses/ASP
> !READ ME FIRST -
SECTION SUMMARY
> Cache frequently used
read-only data in Application variables
> Change your WebClass
(after testing it) from a server to a library process
> Do not use Session
object to maintain state
> Don't mix script
languages on the same page
> Ensure that
server-side debugging is disabled in production sites
> Large or nested
include files can affect ASP performance
> Move ASP code to
compiled VB DLLs
Category: Office
Application Automation (Word/Excel VBA)
> !READ ME FIRST -
SECTION SUMMARY
> Fast excel data
update from recordset
> Hook into the
statsbar and progressbar
> Minimize screen
updates
> Suppress alert
dialogs
> Turn off calculations
for excel when adding data
Category: Perceived
Performance
> !READ ME FIRST -
SECTION SUMMARY
> Nothing says
"please wait" like a hourglass
> Use a splash screen
for your application startup
> Make your application
more fun, use animated cursors
> Controlling the use
(frequency) of DoEvents
> Implement a
ProgressBar without killing real performance
Category: Myths
> !READ ME FIRST -
SECTION SUMMARY
> Multithreading
automatically improves performance
> Simplify If
conditions that involve multiple boolean operators
> The "end"
operator of a For/Next loop is evaluated for each loop iteration
> Using the Xor
operator as a mechanism for swapping the values of two integer variables
Category: Code Review
> !READ ME FIRST -
SECTION SUMMARY
> Find procedure which
are not called in a project
> Find procedures with
no error handling
> Find procedures with
only On Error Resume Next (in line handling)
> Find unused global
variables
> Find unused local
variables
> Find unused modular
variables
Category: Frequently
Asked Questions
> I get an error when I
try to run the ADO sample. What is wrong?
> How do I obtain
technical support?
> How do I use the
pdTimer component?
> I am timing 2
functions with the pdTimer and they change every time I run them ...
what's going on?
> I compile to p-code,
do the tips still apply to me?
> Is a 1 or 2 percent
difference between methods or techniques significant?
> What factors effect
code timings?
> When I run the
pdCodeScanner Addin, it does not show all of the optimization tips - why?
> Why are some of the
categories grayed?
> Why do my results
(timings) differ from yours?
> Why is there a big
variation in the time it takes samples to execute?
|