2 ms·
The typeahead.js library should use a binary search of a sorted string array. A trie of string prefixes would be more elegant, but it would probably have worse
by cpeterso 13y ago
The typeahead.js library should use a binary search of a sorted string array. A trie of string prefixes would be more elegant, but it would probably have worse data locality and heap fragmentation.
And instead of searching the entire database for every new prefix (e.g. "s", "sa", "san", "san f"), the API could return a stateful query object that could be more efficiently refined.