diff options
| author | Alon Levy <alon@pobox.com> | 2014-09-21 16:04:20 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-09-21 16:04:20 +0300 |
| commit | af27835be74279fe894318fe65d097ddff7384b0 (patch) | |
| tree | 723d07d023d3f92366ea0d434a5183916cc482b1 /scripts/select2.js | |
| parent | 9aa40fd4881538878fa68b035f79a72cfaf13b29 (diff) | |
textanalysis: multiple changes to autocomplete
1. move the sugg variable to textanalysis.js instead of the ui part
2. use a callback for the autocomplete widget (it supports three
options: array, string as url for a json returning service, or callback)
3. use a dictionary instead of an array to keep the list of suggestions.
We iterate on the dictionary instead of using a Trie or some other
datastructure in the callback. But the dictionary avoids iteration when
adding a word. Overall a loss in performance, but not noticeable.
Googling / memory suggests a Trie is what we want here, but I'm
postponing that for later. See:
http://ejohn.org/blog/javascript-trie-performance-analysis
Diffstat (limited to 'scripts/select2.js')
0 files changed, 0 insertions, 0 deletions
