mirror of https://github.com/zulip/zulip.git
7d7028b7d0
This looks like simple code cleanup, but it's more than that. The code cleanup here is that we don't have three callbacks to get a list of typeaheads for bootstrap. Instead, we just have one function that does all the main work. And then the speedup comes from the fact we no longer need to remove diacritics from the query for every time through our loop of seeing if a person matches the query. It's a bit subtle to see in the diff, but these are the relevant lines: const matcher = exports.get_person_or_user_group_matcher(query); const filtered_results = _.filter(people_and_groups, matcher); Before this, bootstrap was doing $.grep, and we'd have to reinitialize the matcher for every person. If you profile this before and after, you'll see that remove_diacritics gets called fewer times. To profile this, you want to loads lots of users into your DB and try to autocomplete "Extra", as in "Extra1 User". If you try to autocomplete something else, then my patch won't really help, and `remove_diacritics` will still show up as expensive. Because it is that expensive a function. |
||
---|---|---|
.. | ||
assets | ||
audio | ||
generated | ||
html | ||
images | ||
js | ||
shared | ||
styles | ||
templates | ||
third | ||
.gitignore | ||
favicon.ico |