Prefer std::unordered_map to std::map.

This commit is contained in:
levlam 2021-08-21 21:42:07 +03:00
parent d229c5daed
commit 43d9ba81ac
4 changed files with 7 additions and 6 deletions

View File

@ -26,8 +26,8 @@
#include "td/utils/Status.h"
#include "td/utils/StorerBase.h"
#include <map>
#include <memory>
#include <unordered_map>
#include <utility>
namespace td {
@ -130,7 +130,7 @@ class RawConnectionDefault final : public RawConnection {
PublicFields extra_;
BufferedFd<SocketFd> socket_fd_;
unique_ptr<IStreamTransport> transport_;
std::map<uint32, uint64> quick_ack_to_token_;
std::unordered_map<uint32, uint64> quick_ack_to_token_;
bool has_error_{false};
unique_ptr<StatsCallback> stats_callback_;

View File

@ -26,9 +26,9 @@
#include "td/utils/type_traits.h"
#include <functional>
#include <map>
#include <memory>
#include <type_traits>
#include <unordered_map>
#include <utility>
namespace td {
@ -214,7 +214,7 @@ class Scheduler {
ListNode ready_actors_list_;
KHeap<double> timeout_queue_;
std::map<ActorInfo *, std::vector<Event>> pending_events_;
std::unordered_map<ActorInfo *, std::vector<Event>> pending_events_;
ServiceActor service_actor_;
Poll poll_;

View File

@ -24,9 +24,9 @@
#include <openssl/x509v3.h>
#include <cstring>
#include <map>
#include <memory>
#include <mutex>
#include <unordered_map>
#if TD_PORT_WINDOWS
#include <wincrypt.h>
@ -131,7 +131,7 @@ int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) {
static std::mutex warning_mutex;
{
std::lock_guard<std::mutex> lock(warning_mutex);
static std::map<std::string, double> next_warning_time;
static std::unordered_map<std::string, double> next_warning_time;
double &next = next_warning_time[warning];
if (next <= now) {
next = now + 300; // one warning per 5 minutes

View File

@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <iostream>
#include <map>
#include <tdutils/td/utils/FileLog.h>
#include <tdutils/td/utils/OptionParser.h>
#include <tdutils/td/utils/port/path.h>