Optimal Delphi
This page is dedicated to helping Dephi programmers build fast/stable applications. It is intended for beginner
to intermediate developers. Advanced developers should visit the High Performance Delphi site instead. It is amazing.
Optimizing Delphi
TListBox, TComboBox
- Always surround the code to fill the listbox derived component with a ListBox.BeginUpdate and ListBox.EndUpdate.
A speed hit comes from windows redrawing the listbox everytime you add a new item.
IniFiles
- Try to save to network as little as possible.
Optimizing DBISAM
TDBISAMTable
- Use ranges on tables instead of filters or SQL queries whenever possible, they are much faster.
- Make sure you have an index on each field involved in a filter.
FindKey
- For simple searches use findkey instead of a query whenever you have an index on the searched field(s), it's
a lot faster.
- FindKey works best when using the primary index.
- Scalers (integer etc.) must use 0 not null for empty values.
TDBISAMQuery
- Make sure you have an index on each field involved in a join or in the WHERE clause of a query.
- Order SQL WHERE clauses so that the smallest tables come first.
- When a field has a case-insenstitive index you should use the SQL
UPPER function with queries. eg. WHERE UPPER(Name)="ALLAN"
TDBISAMDataset
- Only do TDBISAMDataset.Refresh on views not updates. Before an update the dataset is automatically refreshed.
- Use FlushBuffers after a Post (not needed for transactions) to prevent table corruption.