Commenting on...
Title: TStringList - Maximizing Performance
By: Wes Peterson
Before adding many new entries to a TStringList, set its Sorted property to false. Add all your entries. Finally, set the Sorted property back to True (if desired).
Sorting is expensive, in terms of macnine cycles. By leaving the Sorted property set to True, you force the TStingList to re-sort itself after each entry. This can significantly slow things down.
This applies to TStrings, as well, and all components that have a TStrings property, like TListBox, etc.
Before adding many new entries to a TStringList, set its Sorted property to false. Add all your entries. Finally, set the Sorted property back to True (if desired)
Sorting is expensive, in terms of macnine cycles. By leaving the Sorted property set to True, you force the TStingList to re-sort itself after each entry. This can significantly slow things down. Your results will be much faster if you add while Sorted is false, then let the TStringList do the sorting all at once, when you're finished.
This applies to TStrings, as well, and all components that have a TStrings property, like TListBox, etc.
Before adding many new entries to a TStringList, set its Sorted property to false. Add all your entries. Finally, set the Sorted property back to True (if desired)
|