From db77165dada47f6fe093668f95cc73ecdfeace7f Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 16 Jan 2021 03:14:15 +0300 Subject: [PATCH] Optimize ContactsManager::search_among_users. --- td/telegram/ContactsManager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index aff32aa7a..e095dde17 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -13370,7 +13370,11 @@ std::pair> ContactsManager::search_among_users(const vecto if (u == nullptr) { continue; } - hints.add(user_id.get(), u->first_name + " " + u->last_name + " " + u->username); + if (query.empty()) { + hints.add(user_id.get(), Slice(" ")); + } else { + hints.add(user_id.get(), PSLICE() << u->first_name << ' ' << u->last_name << ' ' << u->username); + } hints.set_rating(user_id.get(), -get_user_was_online(u, user_id)); }