mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-07 04:33:24 +00:00
[common] Switch to boost::unordered_flat containers (#4326)
Replaces all instances of ankerl's unordered map/set with boost's `unordered_flat_*` classes. This uses std::hash since boost::hash is actually a lot slower. Also adds an abstraction layer in `Common` so future changes are quicker and easier. Other implementation details: - ankerl provided hash specializations for tuple and pair, so those were ported here - std::erase_if doesn't work on boost, so just used the ADL'd erase_if This should be about equal or superior performance as unordered_dense for everything except iteration. Signed-off-by: crueter <crueter@eden-emu.dev> - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4326 Reviewed-by: Lizzie and Samuel <lizzie@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include <array>
|
||||
|
||||
#include <sirit/sirit.h>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include "common/container/unordered_set.h"
|
||||
|
||||
#include "shader_recompiler/backend/bindings.h"
|
||||
#include "shader_recompiler/frontend/ir/program.h"
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
Id load_const_func_u32x4{};
|
||||
|
||||
// Sirit::Id doesn't play nice with *::set<>
|
||||
ankerl::unordered_dense::set<u32> non_uniform_ids;
|
||||
::Common::unordered_set<u32> non_uniform_ids;
|
||||
|
||||
bool uses_nonuniform_sampled_image{};
|
||||
bool uses_nonuniform_storage_image{};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include "common/container/unordered_map.h"
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "shader_recompiler/program_header.h"
|
||||
@@ -126,9 +126,9 @@ protected:
|
||||
u32 start_address{};
|
||||
bool is_proprietary_driver{};
|
||||
public:
|
||||
ankerl::unordered_dense::map<CbufWordKey, u32, CbufWordKeyHash> cbuf_word_cache;
|
||||
ankerl::unordered_dense::map<HandleKey, u32, HandleKeyHash> handle_cache;
|
||||
ankerl::unordered_dense::map<const IR::Inst*, ConstBufferAddr> track_cache;
|
||||
::Common::unordered_map<CbufWordKey, u32, CbufWordKeyHash> cbuf_word_cache;
|
||||
::Common::unordered_map<HandleKey, u32, HandleKeyHash> handle_cache;
|
||||
::Common::unordered_map<const IR::Inst*, ConstBufferAddr> track_cache;
|
||||
};
|
||||
|
||||
} // namespace Shader
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include "common/container/unordered_map.h"
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -390,7 +390,7 @@ private:
|
||||
std::optional<Node> return_label) {
|
||||
Statement* const false_stmt{pool.Create(Identity{}, IR::Condition{false}, &root_stmt)};
|
||||
Tree& root{root_stmt.children};
|
||||
ankerl::unordered_dense::map<Flow::Block*, Node> local_labels;
|
||||
::Common::unordered_map<Flow::Block*, Node> local_labels;
|
||||
local_labels.reserve(function.blocks.size());
|
||||
|
||||
for (Flow::Block& block : function.blocks) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <span>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include "common/container/unordered_map.h"
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <optional>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include "common/container/unordered_map.h"
|
||||
#include <tuple>
|
||||
#include <limits>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
Reference in New Issue
Block a user