mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-28 08:53:37 +00:00
[core] Switch to ankerl::unordered_dense
Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
@@ -8,9 +8,10 @@
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
// This class MUST NOT run OpenGL-related tasks (which invoke OpenGL or contain any
|
||||
@@ -147,7 +148,7 @@ private:
|
||||
m_condition.notify_all();
|
||||
}
|
||||
|
||||
std::unordered_set<uint64_t> m_finishedIds;
|
||||
ankerl::unordered_dense::set<uint64_t> m_finishedIds;
|
||||
uint64_t m_counter = 0;
|
||||
bool m_finished = false;
|
||||
std::condition_variable m_condition;
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
#include "drape/pointers.hpp"
|
||||
#include "drape/shader.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
class GLGpuProgram : public GpuProgram
|
||||
@@ -29,7 +30,7 @@ public:
|
||||
glConst m_type = gl_const::GLFloatType;
|
||||
};
|
||||
|
||||
using UniformsInfo = std::unordered_map<std::string, UniformInfo>;
|
||||
using UniformsInfo = ankerl::unordered_dense::map<std::string, UniformInfo>;
|
||||
UniformsInfo const & GetUniformsInfo() const;
|
||||
uint32_t GetNumericUniformsCount() const { return m_numericUniformsCount; }
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ FreetypeError constexpr g_FT_Errors[] =
|
||||
FT_StreamRec_ m_stream;
|
||||
FT_Face m_fontFace;
|
||||
|
||||
std::unordered_set<uint16_t> m_readyGlyphs;
|
||||
ankerl::unordered_dense::set<uint16_t> m_readyGlyphs;
|
||||
|
||||
hb_font_t * m_harfbuzzFont{nullptr};
|
||||
};
|
||||
@@ -328,13 +328,13 @@ FreetypeError constexpr g_FT_Errors[] =
|
||||
TUniBlockIter m_lastUsedBlock;
|
||||
std::vector<std::unique_ptr<Font>> m_fonts;
|
||||
|
||||
// Required to use std::string_view as a search key for std::unordered_map::find().
|
||||
// Required to use std::string_view as a search key for ankerl::unordered_dense::map::find().
|
||||
struct StringHash : public std::hash<std::string_view>
|
||||
{
|
||||
using is_transparent = void;
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, text::TextMetrics, StringHash, std::equal_to<>> m_textMetricsCache;
|
||||
ankerl::unordered_dense::map<std::string, text::TextMetrics, StringHash, std::equal_to<>> m_textMetricsCache;
|
||||
hb_buffer_t * m_harfbuzzBuffer;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
namespace detail
|
||||
@@ -52,7 +53,7 @@ class OverlayTree : public m4::Tree<ref_ptr<OverlayHandle>, detail::OverlayTrait
|
||||
using TBase = m4::Tree<ref_ptr<OverlayHandle>, detail::OverlayTraits>;
|
||||
|
||||
public:
|
||||
using HandlesCache = std::unordered_set<ref_ptr<OverlayHandle>, detail::OverlayHasher>;
|
||||
using HandlesCache = ankerl::unordered_dense::set<ref_ptr<OverlayHandle>, detail::OverlayHasher>;
|
||||
|
||||
explicit OverlayTree(double visualScale);
|
||||
|
||||
|
||||
@@ -57,10 +57,8 @@ void RenderBucket::Update(ScreenBase const & modelView)
|
||||
{
|
||||
BeforeUpdate();
|
||||
for (auto & overlayHandle : m_overlay)
|
||||
{
|
||||
if (overlayHandle->IsVisible())
|
||||
overlayHandle->Update(modelView);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderBucket::CollectOverlayHandles(ref_ptr<OverlayTree> tree)
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
void UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture);
|
||||
|
||||
private:
|
||||
// std::unordered_map can be better here
|
||||
// ankerl::unordered_dense::map can be better here
|
||||
typedef std::map<StipplePenKey, StipplePenResourceInfo> TResourceMapping;
|
||||
typedef std::pair<m2::RectU, StipplePenRasterizator> TPendingNode;
|
||||
typedef std::vector<TPendingNode> TPendingNodes;
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
#include "drape/texture.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
class SymbolsTexture : public Texture
|
||||
@@ -50,6 +51,6 @@ private:
|
||||
ref_ptr<HWTextureAllocator> allocator);
|
||||
|
||||
std::string m_name;
|
||||
mutable std::unordered_map<std::string, SymbolInfo> m_definition;
|
||||
mutable ankerl::unordered_dense::map<std::string, SymbolInfo> m_definition;
|
||||
};
|
||||
} // namespace dp
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
@@ -48,7 +49,7 @@ private:
|
||||
|
||||
private:
|
||||
GlyphUsageStatistic m_glyphStat;
|
||||
std::unordered_set<std::string> m_processedStrings;
|
||||
ankerl::unordered_dense::set<std::string> m_processedStrings;
|
||||
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
class GPUMemTracker
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
uint32_t m_summaryAllocatedInMb = 0;
|
||||
uint32_t m_summaryUsedInMb = 0;
|
||||
std::map<std::string, TagMemorySnapshot> m_tagStats;
|
||||
std::unordered_map<uint64_t, AverageAllocation> m_averageAllocations;
|
||||
ankerl::unordered_dense::map<uint64_t, AverageAllocation> m_averageAllocations;
|
||||
};
|
||||
|
||||
static GPUMemTracker & Inst();
|
||||
@@ -57,7 +58,7 @@ private:
|
||||
using TAlocUsedMem = std::pair<uint32_t, uint32_t>;
|
||||
using TMemTag = std::pair<std::string, uint32_t>;
|
||||
std::map<TMemTag, TAlocUsedMem> m_memTracker;
|
||||
std::unordered_map<uint64_t, AverageAllocation> m_averageAllocations;
|
||||
ankerl::unordered_dense::map<uint64_t, AverageAllocation> m_averageAllocations;
|
||||
|
||||
std::mutex m_mutex;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace vulkan
|
||||
class VulkanGpuProgram : public GpuProgram
|
||||
{
|
||||
public:
|
||||
using TextureBindings = std::unordered_map<std::string, int8_t>;
|
||||
using TextureBindings = ankerl::unordered_dense::map<std::string, int8_t>;
|
||||
|
||||
VulkanGpuProgram(std::string const & programName, VkPipelineShaderStageCreateInfo const & vertexShader,
|
||||
VkPipelineShaderStageCreateInfo const & fragmentShader, VkDescriptorSetLayout descriptorSetLayout,
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "3party/ankerl/unordered_dense.h"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
namespace vulkan
|
||||
@@ -89,7 +90,7 @@ private:
|
||||
uint32_t m_totalAllocationCounter = 0;
|
||||
|
||||
using MemoryBlocks = std::vector<drape_ptr<MemoryBlock>>;
|
||||
std::array<std::unordered_map<uint64_t, MemoryBlocks>, kResourcesCount> m_memory;
|
||||
std::array<ankerl::unordered_dense::map<uint64_t, MemoryBlocks>, kResourcesCount> m_memory;
|
||||
std::array<MemoryBlocks, kResourcesCount> m_freeBlocks;
|
||||
std::array<uint32_t, kResourcesCount> m_sizes = {};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user