My project is using the wicket-jquery-ui AutoCompleteTextField.  We're
returning a list that was prefetched and all we do in the getChoices is
create a sublist.  the entire getChoices runs in milliseconds...usually
20-30, which I know because I put a rudimentary timer in it.  Yet, the
autocomplete feels very sluggish as we're testing it.  So I put a timer in a
filter that wraps our wicket calls and timed that.  The filter timer shows
the entire event is running 2-4 seconds.

2-4 seconds per keystroke when the fattest part of the call, the data
retrieval, is only taking 20-30ms seems like something is wrong.  The list's
max size is being limited to 100 rows, but even when I pared it down to 10
rows the improvement was only marginal.

I pasted the code below, but that mostly just shows the getChoices() which,
as I said above, is just filtering over a list in memory.  Any ideas?

                AutoCompleteTextField<String> fld = new
AutoCompleteTextField<String>(fldId)
                {
                        protected List<String> getChoices(String input) {
                                long start = System.currentTimeMillis();
                                if (minInputLen > 0) {
                                        if (input == null || 
input.trim().length() < minInputLen) {
                                                return Collections.EMPTY_LIST;  
// empty list
                                        }
                                }
                                
                                List<String> curMatchingList = 
getFilterList(valList, input,
maxFilterListSize);     // filters the in memory list valList by the input

                                if (curMatchingList == null) {
                                        curMatchingList = new 
ArrayList<String>();
                                }
                                
                                if (curMatchingList.size() == 0) {
                                        if (noResultsVal != null) {
                                                
curMatchingList.add(noResultsVal);      // no-results option
                                        }
                                }
                                System.out.println("GETCHOICES: " + 
(System.currentTimeMillis() -
start));
                                return curMatchingList; // data list
                        }
                };

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to