Propaganda‎ > ‎


Glazed Lists takes performance seriously. This page is a collection of tests, strategies and discussions with the common goal to making everything run faster.


Sort before Filter

You should filter your sorted list rather than sorting your filtered list. Basically I mean you should replace this:
     Matcher myMatcher = ...;
EventList base = new BasicEventList();
     EventList filtered = new FilterList(base, myMatcher);
     EventList sorted = new SortedList(filtered);
with this:
     Matcher myMatcher = ...;
EventList base = new BasicEventList();
     EventList sorted = new SortedList(base);
     EventList filtered = new FilterList(sorted, myMatcher);
The main difference is that whenever you filter, the sorted list no longer needs to re-sort the elements. This will save a few CPU cycles.

Shorter filter Strings

The FilterList will perform better on several short strings than on one large String. For example, it is faster to filter
     { "C", "Documents and Settings", "Administrator", "My Photos", "DSC03141.JPG" }
than it is to filter:
    { "C:\Documents and Settings\Administrator\My Photos\DSC03141.JPEG" }
Note that any potential speed increase will be lost if you break up a larger String into smaller strings in your getFilterStrings() method. Instead, get the filter Strings in advance and return them when that method is called.

The reason this is faster is that the FilterList does not need to consider such subtrings as "Photos\DSC" or "Settings\Administrator". If you need these values to work, you can't use this optimization.


Performance FAQ

Tests and Comparisons

(old) Sorted JTables includes a simplistic performance comparison of the Glazed Lists to JDNC, and TableSorter