kryali / classwhole

interactive course scheduler
http://classwhole.com
Apache License 2.0
11 stars 4 forks source link

autcomplete - ideas and cache #16

Closed wilson29 closed 13 years ago

wilson29 commented 13 years ago

gave up on caching - instead just make a local cash, simply a hash of different "class list" ... it cuts down the time spent in ActiceRecord from ~15ms to 0. However it was already fast, and the difference would most likely go unnoticed by anyone not coding this.... haha

anyways, i went to scheedule to check out their autocomplete and something -

if you type in "cs" you get a dropdown of "cs" and "cse"

play withit yourself to see what i mean http://illinois.scheedule.com/scheduler

ANYWAYS, I think it'd be neat if we can implement that - I think it would make autocomplete noticeable better

jhughes commented 13 years ago

The speed increase will definitely be nice in the long run. Now the only latency we should notice will be round trip time, which will hopefully be negligible. It would be really cool to get the better search working, we should definitely look into it.

kryali commented 13 years ago

I agree, the speed increase in this will definitely be noticeable to using the form.

Also, Scheedule's autocomplete is blazingly fast which makes me think that it is being sent locally.

If we can't match the speed using autocomplete remotely, should we do it locally? (send the browser a javascript array of all possible class names)

kryali commented 13 years ago

I finished the smarter autocomplete

kryali commented 13 years ago

So guess what, I made autocomplete 8-10 times faster. I used something called redis. Just think of it as a hash.

Basically, I store everything we need for the autocomplete search in a hash. Since it's in memory we do no database queries.

Avg response time has gone down from 50-70ms to 8-15ms. (this baby FLIES)

http://en.wikipedia.org/wiki/Trie

jhughes commented 13 years ago

A couple of issues:

  1. Doesn't work with lower case letters.
  2. Doesn't go back to subject mode after going into course mode and backspacing back into the subject.
kryali commented 13 years ago

Other issues:

  1. Won't look for a class if autocomplete isn't open. (i.e. if you type in cs 225 really fast, nothing gets added) update: can't reproduce
  2. The suggestion background text is off by a few pixels in some scenarios. (i.e. offset on my mac, and fine on my linux)
  3. Mode switching doesn't work for all cases
kryali commented 13 years ago

Using autocomplete for a while makes the ec2 come to a halt.. update: seems to be related to calling the fallback

kryali commented 13 years ago

sort results by class sizes