diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-05-30 16:51:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-30 16:51:12 -0700 |
commit | 0b6a1f5aa243d8542c086d4274e43bf411d63d59 (patch) | |
tree | a0ccd69bb8c698ae4a8315fc30ab35ee0c4636d7 /src/emscripten-optimizer | |
parent | 706b3f6c6cc95d688a5f97e9d82e15df6d04d54d (diff) | |
download | binaryen-0b6a1f5aa243d8542c086d4274e43bf411d63d59.tar.gz binaryen-0b6a1f5aa243d8542c086d4274e43bf411d63d59.tar.bz2 binaryen-0b6a1f5aa243d8542c086d4274e43bf411d63d59.zip |
Optimize validation of many nested blocks (#1576)
On the testcase from https://github.com/tweag/asterius/issues/19#issuecomment-393052653 this makes us almost 3x faster, and use 25% less memory.
The main improvement here is to simplify and optimize the data structures the validator uses to validate br targets: use unordered maps, and use one less of them. Also some speedups from using that map more effectively (use of iterators to avoid multiple lookups).
Also move the duplicate-node checks to the internal IR validation section, which makes more sense anyhow (it's not wasm validation, it's internal IR validation, which like the check for stale internal types, we do only if debugging).
Diffstat (limited to 'src/emscripten-optimizer')
-rw-r--r-- | src/emscripten-optimizer/istring.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/emscripten-optimizer/istring.h b/src/emscripten-optimizer/istring.h index 8c77c4499..467ae682d 100644 --- a/src/emscripten-optimizer/istring.h +++ b/src/emscripten-optimizer/istring.h @@ -159,8 +159,7 @@ namespace std { template <> struct hash<cashew::IString> : public unary_function<cashew::IString, size_t> { size_t operator()(const cashew::IString& str) const { - size_t hash = size_t(str.str); - return hash = ((hash << 5) + hash) ^ 5381; /* (hash * 33) ^ c */ + return std::hash<size_t>{}(size_t(str.str)); } }; |