IT SOLUTIONS
Your TECHNOLOGY partner! 
 
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P183A
Enter key:
Write a Comment...

Commenting on...

[View/Review Post]
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)

-
  Load Time=less than 1 second.
 
Print This

KB Post Options:
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


©1995-2013 Prestwood IT Solutions.   [Security & Privacy]   Made in the U.S.A..   No H1-B.   No offshoring.