[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:
crueter
2026-08-31 02:58:09 +02:00
parent 106a61c943
commit 7fda6dde73
118 changed files with 348 additions and 340 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
#pragma once
#include <string>
#include <ankerl/unordered_dense.h>
#include "common/container/unordered_map.h"
#include "qt_common/config/qt_config.h"
@@ -35,5 +35,5 @@ public:
private:
bool ProfileExistsInMap(const std::string& profile_name) const;
ankerl::unordered_dense::map<std::string, std::unique_ptr<QtConfig>> map_profiles;
::Common::unordered_map<std::string, std::unique_ptr<QtConfig>> map_profiles;
};
+1 -1
View File
@@ -13,7 +13,7 @@
#include <QPixmap>
#include <QPropertyAnimation>
#include <QStyleOption>
#include <ankerl/unordered_dense.h>
#include "common/container/unordered_map.h"
#include "core/frontend/framebuffer_layout.h"
#include "core/loader/loader.h"
#include "ui_loading_screen.h"
+2 -2
View File
@@ -80,8 +80,8 @@ private:
std::unique_ptr<QPropertyAnimation> fadeout_animation;
// Definitions for the differences in text and styling for each stage
ankerl::unordered_dense::map<VideoCore::LoadCallbackStage, const char*> progressbar_style;
ankerl::unordered_dense::map<VideoCore::LoadCallbackStage, QString> stage_translations;
::Common::unordered_map<VideoCore::LoadCallbackStage, const char*> progressbar_style;
::Common::unordered_map<VideoCore::LoadCallbackStage, QString> stage_translations;
// newly generated shaders are added to the end of the file, so when loading and compiling
// shaders, it will start quickly but end slow if new shaders were added since previous launch.
+4 -3
View File
@@ -10,7 +10,8 @@
#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QVariant>
#include <ankerl/unordered_dense.h>
#include "common/container/unordered_map.h"
#include "common/container/unordered_set.h"
#include "network/network.h"
namespace Ui {
@@ -65,8 +66,8 @@ private:
bool has_mod_perms = false;
QStandardItemModel* player_list;
std::unique_ptr<Ui::ChatRoom> ui;
ankerl::unordered_dense::set<std::string> block_list;
ankerl::unordered_dense::map<std::string, QPixmap> icon_cache;
::Common::unordered_set<std::string> block_list;
::Common::unordered_map<std::string, QPixmap> icon_cache;
};
Q_DECLARE_METATYPE(Network::ChatEntry);