Community
Participate
Working Groups
Build Identifier: 3.5.2 TextUtils.getShortString() is used from the DefaultCellRenderer to abbreviate texts if the grid is not word wrapping. For particular strings with a length of about 2000 characters this method can consume up to 600ms on my Core duo 2.5 GHZ. The algorithm splits the string and then decreases it by one until it fits into the width of the column. For every turn it calls GC.textExtent twice. Assuming that the text width is an ordered function over the character size the algorithm could use a binary search and thereby reduce the number of calls from n to log n. Attached is a patch with the modified algorithm and test cases for checking the compatibility with the existing implementation. It reduces the time to about 15ms for the example (which is also part of the test case). Reproducible: Always
Created attachment 191419 [details] Patch for Text Util
*** This bug has been marked as a duplicate of bug 440812 ***