[core] Switch to ankerl::unordered_dense

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-11-24 17:34:56 +00:00
parent 7e561d09d3
commit 0288b97b13
282 changed files with 4385 additions and 1457 deletions

View File

@@ -7,9 +7,10 @@
#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
namespace storage
{
template <typename TaskInfo>
@@ -76,6 +77,6 @@ private:
std::optional<TaskInfo> m_taskInfo;
};
std::unordered_map<CountryId, TaskData> m_queue;
ankerl::unordered_dense::map<CountryId, TaskData> m_queue;
};
} // namespace storage

View File

@@ -17,9 +17,10 @@
#include <mutex>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace storage
{
// This class allows users to get information about country by point or by name.
@@ -119,7 +120,7 @@ protected:
// @TODO(bykoianko): consider getting rid of m_countryIndex.
// Maps all leaf country id (file names) to their indices in m_countries.
std::unordered_map<CountryId, RegionId> m_countryIndex;
ankerl::unordered_dense::map<CountryId, RegionId> m_countryIndex;
Affiliations const * m_affiliations = nullptr;

View File

@@ -8,9 +8,10 @@
#include <memory>
#include <sstream>
#include <string>
#include <unordered_map>
#include <utility>
#include "3party/ankerl/unordered_dense.h"
#include "cppjansson/cppjansson.hpp"
#include "private.h"

View File

@@ -5,7 +5,8 @@
#include <cstdint>
#include <functional>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace storage
{
@@ -13,7 +14,7 @@ namespace diffs
{
struct LocalMapsInfo final
{
using NameVersionMap = std::unordered_map<storage::CountryId, uint64_t>;
using NameVersionMap = ankerl::unordered_dense::map<storage::CountryId, uint64_t>;
uint64_t m_currentDataVersion = 0;
NameVersionMap m_localMaps;

View File

@@ -4,7 +4,8 @@
#include <cstdint>
#include <string>
#include <unordered_map>
#include "3party/ankerl/unordered_dense.h"
namespace storage
{
@@ -26,6 +27,6 @@ struct DiffInfo final
bool m_isApplied = false;
};
using NameDiffInfoMap = std::unordered_map<storage::CountryId, DiffInfo>;
using NameDiffInfoMap = ankerl::unordered_dense::map<storage::CountryId, DiffInfo>;
} // namespace diffs
} // namespace storage

View File

@@ -21,10 +21,11 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace storage_tests
{
struct UnitClass_StorageTest_DeleteCountry;
@@ -163,7 +164,7 @@ public:
using DeleteCallback = std::function<bool(storage::CountryId const &, LocalFilePtr const)>;
using ChangeCountryFunction = std::function<void(CountryId const &)>;
using ProgressFunction = std::function<void(CountryId const &, downloader::Progress const &)>;
using DownloadingCountries = std::unordered_map<CountryId, downloader::Progress>;
using DownloadingCountries = ankerl::unordered_dense::map<CountryId, downloader::Progress>;
private:
/// We support only one simultaneous request at the moment
@@ -195,7 +196,7 @@ private:
// cancelled. However, the storage thread knows for sure whether
// request was to apply or to cancel the diff, and this knowledge
// is represented by |m_diffsBeingApplied|.
std::unordered_map<CountryId, std::unique_ptr<base::Cancellable>> m_diffsBeingApplied;
ankerl::unordered_dense::map<CountryId, std::unique_ptr<base::Cancellable>> m_diffsBeingApplied;
std::vector<platform::LocalCountryFile> m_notAppliedDiffs;

View File

@@ -10,10 +10,11 @@
#include <memory>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "3party/ankerl/unordered_dense.h"
namespace storage
{
using CountryId = std::string;
@@ -22,12 +23,12 @@ using CountriesVec = std::vector<CountryId>;
using LocalFilePtr = std::shared_ptr<platform::LocalCountryFile>;
using OldMwmMapping = std::map<CountryId, CountriesSet>;
/// Map from key affiliation words into CountryIds.
using Affiliations = std::unordered_map<std::string, std::vector<CountryId>>;
using Affiliations = ankerl::unordered_dense::map<std::string, std::vector<CountryId>>;
/// Map from country name synonyms and old names into CountryId.
using CountryNameSynonyms = std::unordered_map<std::string, CountryId>;
using CountryNameSynonyms = ankerl::unordered_dense::map<std::string, CountryId>;
/// Map from CountryId into city GeoObject id.
using MwmTopCityGeoIds = std::unordered_map<CountryId, base::GeoObjectId>;
using MwmTopCountryGeoIds = std::unordered_map<CountryId, std::vector<base::GeoObjectId>>;
using MwmTopCityGeoIds = ankerl::unordered_dense::map<CountryId, base::GeoObjectId>;
using MwmTopCountryGeoIds = ankerl::unordered_dense::map<CountryId, std::vector<base::GeoObjectId>>;
extern storage::CountryId const kInvalidCountryId;