impr: Make loading of large table files significantly faster

This commit is contained in:
WerWolv
2023-06-21 23:58:21 +02:00
parent e1b0c1c268
commit d65e669bbb
3 changed files with 108 additions and 62 deletions

View File

@@ -20,10 +20,15 @@ namespace hex {
Thingy
};
EncodingFile() = default;
EncodingFile();
EncodingFile(const EncodingFile &other);
EncodingFile(EncodingFile &&other);
EncodingFile(Type type, const std::fs::path &path);
EncodingFile(Type type, const std::string &path);
EncodingFile& operator=(const EncodingFile &other);
EncodingFile& operator=(EncodingFile &&other);
[[nodiscard]] std::pair<std::string_view, size_t> getEncodingFor(std::span<u8> buffer) const;
[[nodiscard]] size_t getEncodingLengthFor(std::span<u8> buffer) const;
[[nodiscard]] size_t getLongestSequence() const { return this->m_longestSequence; }
@@ -38,7 +43,7 @@ namespace hex {
bool m_valid = false;
std::string m_tableContent;
std::map<size_t, std::map<std::vector<u8>, std::string>> m_mapping;
std::unique_ptr<std::map<size_t, std::map<std::vector<u8>, std::string>>> m_mapping;
size_t m_longestSequence = 0;
};