Making auto-completion faster?

I just started playing around with the auto-completion
(text_field_with_auto_complete) stuff, and it is very nice, but it
seems a little slow-- it takes about 1 second for the list to appear
or for an update. The development log says the the SQL query
completes in 0.01 s, so I'm wondering if there's some built in delay
in the ruby/javascript code. Is there some way to configure it to be
faster? Or is the delay in WEBrick?

Thanks,
      --Paul

There's a (by default) 0.4s delay in the JavaScript to know that you've stopped typing. Then there's the round trip to the server (which sounds like it's local in your case), but you still might have a bit of rendering time to include which might be significant if the list of completions is long.

-Rob

Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com

Thanks! I searched for the 0.4 and found the frequency option which
(in case anyone else wants to do this) I set like this:

<%= text_field_with_auto_complete :answer, :answer_text,
                       {}, :frequency=>0.1 %>

That made things faster (though not 4 times faster, because of the
server
response time). The downside is that now every keystroke initiates a
request
for an update, which might not scale so well if there are lots of
users.

Paul Lynch wrote:

Thanks! I searched for the 0.4 and found the frequency option which
(in case anyone else wants to do this) I set like this:

<%= text_field_with_auto_complete :answer, :answer_text,
                       {}, :frequency=>0.1 %>

/Rails Recipes/ covers auto_complete where the source array is
preloaded at page fetch time.

That naturally might not fit your situation. One might also think of a
hybrid that preloads a table and then adds to it dynamically...