From 86bceb29722950f5ac80a69c33080d5e433dcb54 Mon Sep 17 00:00:00 2001 From: Arseny Smirnov Date: Mon, 7 Feb 2022 20:41:07 +0100 Subject: [PATCH] td: replace most of std::unordered_map usages to td::FlatHashMap --- td/telegram/AnimationsManager.h | 4 +- td/telegram/AudiosManager.h | 4 +- td/telegram/BackgroundManager.h | 14 +-- td/telegram/CallManager.h | 4 +- td/telegram/Client.cpp | 8 +- td/telegram/ClientJson.cpp | 2 +- td/telegram/ClientJson.h | 4 +- td/telegram/ConfigManager.cpp | 6 +- td/telegram/ConfigShared.cpp | 2 +- td/telegram/ConfigShared.h | 4 +- td/telegram/ContactsManager.cpp | 6 +- td/telegram/ContactsManager.h | 64 +++++----- td/telegram/CountryInfoManager.cpp | 2 +- td/telegram/CountryInfoManager.h | 6 +- td/telegram/DialogFilter.cpp | 4 +- td/telegram/DialogFilter.h | 6 +- td/telegram/DocumentsManager.h | 4 +- td/telegram/FileReferenceManager.h | 4 +- td/telegram/Global.h | 4 +- td/telegram/GroupCallManager.cpp | 2 +- td/telegram/GroupCallManager.h | 16 +-- td/telegram/InlineQueriesManager.h | 8 +- td/telegram/LanguagePackManager.cpp | 28 +++-- td/telegram/LanguagePackManager.h | 10 +- td/telegram/MessageReaction.cpp | 2 +- td/telegram/MessageReaction.h | 4 +- td/telegram/MessagesManager.cpp | 42 +++---- td/telegram/MessagesManager.h | 154 ++++++++++++------------ td/telegram/NotificationManager.cpp | 6 +- td/telegram/NotificationManager.h | 22 ++-- td/telegram/PollManager.cpp | 8 +- td/telegram/PollManager.h | 10 +- td/telegram/QueryCombiner.h | 4 +- td/telegram/SecureManager.h | 4 +- td/telegram/SequenceDispatcher.h | 4 +- td/telegram/SponsoredMessageManager.cpp | 2 +- td/telegram/SponsoredMessageManager.h | 4 +- td/telegram/StickersManager.cpp | 8 +- td/telegram/StickersManager.h | 52 ++++---- td/telegram/Td.h | 8 +- td/telegram/VideoNotesManager.h | 4 +- td/telegram/VideosManager.h | 4 +- td/telegram/VoiceNotesManager.h | 4 +- td/telegram/WebPageBlock.cpp | 28 ++--- td/telegram/WebPageBlock.h | 8 +- td/telegram/WebPagesManager.cpp | 14 +-- td/telegram/WebPagesManager.h | 18 +-- td/telegram/cli.cpp | 14 +-- td/telegram/files/FileManager.h | 4 +- td/telegram/files/FileStats.cpp | 13 +- td/telegram/files/FileStats.h | 4 +- td/telegram/files/FileStatsWorker.cpp | 4 +- td/telegram/net/ConnectionCreator.h | 6 +- td/telegram/net/Session.h | 4 +- tddb/td/db/BinlogKeyValue.h | 12 +- tddb/td/db/KeyValueSyncInterface.h | 6 +- tddb/td/db/SeqKeyValue.h | 8 +- tddb/td/db/SqliteKeyValue.cpp | 2 +- tddb/td/db/SqliteKeyValue.h | 8 +- tddb/td/db/SqliteKeyValueAsync.cpp | 6 +- tddb/td/db/SqliteKeyValueAsync.h | 4 +- tddb/td/db/TQueue.cpp | 4 +- tddb/td/db/TsSeqKeyValue.h | 4 +- tdutils/test/misc.cpp | 3 +- test/db.cpp | 2 +- 65 files changed, 377 insertions(+), 361 deletions(-) diff --git a/td/telegram/AnimationsManager.h b/td/telegram/AnimationsManager.h index f2c968c0f..01ffb3642 100644 --- a/td/telegram/AnimationsManager.h +++ b/td/telegram/AnimationsManager.h @@ -20,7 +20,7 @@ #include "td/utils/common.h" #include "td/utils/Status.h" -#include +#include "td/utils/FlatHashMap.h" namespace td { @@ -142,7 +142,7 @@ class AnimationsManager final : public Actor { Td *td_; ActorShared<> parent_; - std::unordered_map, FileIdHash> animations_; + FlatHashMap, FileIdHash> animations_; int32 saved_animations_limit_ = 200; vector saved_animation_ids_; diff --git a/td/telegram/AudiosManager.h b/td/telegram/AudiosManager.h index b962eac1e..886e4a499 100644 --- a/td/telegram/AudiosManager.h +++ b/td/telegram/AudiosManager.h @@ -15,7 +15,7 @@ #include "td/utils/buffer.h" #include "td/utils/common.h" -#include +#include "td/utils/FlatHashMap.h" namespace td { @@ -75,7 +75,7 @@ class AudiosManager { FileId on_get_audio(unique_ptr