mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #9011 from unknownbrackets/savestates
Use unordered lookups for better speed
This commit is contained in:
commit
ff66fe7f89
2 changed files with 17 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/logging.h"
|
||||
|
@ -1251,7 +1252,7 @@ static const ReplacementTableEntry entries[] = {
|
|||
|
||||
|
||||
static std::map<u32, u32> replacedInstructions;
|
||||
static std::map<std::string, std::vector<int> > replacementNameLookup;
|
||||
static std::unordered_map<std::string, std::vector<int> > replacementNameLookup;
|
||||
|
||||
void Replacement_Init() {
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(entries); i++) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include "base/mutex.h"
|
||||
#include "ext/cityhash/city.h"
|
||||
#include "Common/FileUtil.h"
|
||||
|
@ -59,9 +60,22 @@ struct HashMapFunc {
|
|||
bool operator < (const HashMapFunc &other) const {
|
||||
return hash < other.hash || (hash == other.hash && size < other.size);
|
||||
}
|
||||
|
||||
bool operator == (const HashMapFunc &other) const {
|
||||
return hash == other.hash && size == other.size;
|
||||
}
|
||||
};
|
||||
|
||||
static std::set<HashMapFunc> hashMap;
|
||||
namespace std {
|
||||
template <>
|
||||
struct hash<HashMapFunc> {
|
||||
size_t operator()(const HashMapFunc &f) const {
|
||||
return std::hash<u64>()(f.hash) ^ f.size;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static std::unordered_set<HashMapFunc> hashMap;
|
||||
|
||||
static std::string hashmapFileName;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue