constant_pool: Use tsl::robin_map rather than unordered_map

Finding a much more drastic improvement with `robin_map`.

`map`:
```
[master] % hyperfine -r 100 "./dynarmic_tests --durations yes"
Benchmark 1: ./dynarmic_tests --durations yes
  Time (mean ± σ):     567.0 ms ±   6.9 ms    [User: 513.1 ms, System: 53.2 ms]
  Range (min … max):   554.4 ms … 588.1 ms    100 runs
```

`unordered_map`:
```
[opt_const_pool] % hyperfine -r 100 "./dynarmic_tests --durations yes"
Benchmark 1: ./dynarmic_tests --durations yes
  Time (mean ± σ):     561.1 ms ±   4.5 ms    [User: 508.1 ms, System: 52.3 ms]
  Range (min … max):   552.6 ms … 574.2 ms    100 runs
```

`tsl::robin_map`:
```
[opt_const_pool] % hyperfine -r 100 "./dynarmic_tests --durations yes"
Benchmark 1: ./dynarmic_tests --durations yes
  Time (mean ± σ):     553.5 ms ±   5.6 ms    [User: 500.7 ms, System: 52.1 ms]
  Range (min … max):   545.7 ms … 569.3 ms    100 runs
```
This commit is contained in:
Wunkolo 2021-12-24 10:35:08 -08:00 committed by merry
parent e57bb0569a
commit ad5465d6ce

View file

@ -6,9 +6,9 @@
#pragma once #pragma once
#include <bit> #include <bit>
#include <unordered_map>
#include <utility> #include <utility>
#include <tsl/robin_map.h>
#include <xbyak/xbyak.h> #include <xbyak/xbyak.h>
#include "dynarmic/common/common_types.h" #include "dynarmic/common/common_types.h"
@ -36,7 +36,7 @@ private:
} }
}; };
std::unordered_map<std::pair<u64, u64>, void*, ConstantHash> constant_info; tsl::robin_map<std::pair<u64, u64>, void*, ConstantHash> constant_info;
BlockOfCode& code; BlockOfCode& code;
size_t pool_size; size_t pool_size;