improve the search algorithm

1. sort the array
2. stop compare after the last match string

profiling by FF builtin Profile Dev tool
test method: key in data
test data: 'a'
before average 25 ms in autocomp()
after  average 20 ms in autocomp()
add function 'can_submit'

check if the value is the same as option