From 51c8f2469f8fd05197b7694c65041b1567f2c6b5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 6 Feb 2021 00:46:37 +0000 Subject: Use unordered maps of Name where possible (#3546) Unordered maps will hash the pointer, while ordered ones will compare the strings to find where to insert in the tree. I cannot confirm a speedup in time from this, though others can, but I do see a consistent improvement of a few % in perf stat results like number of instructions and cycles (and those results have little noise). And it seems logical that this could be faster. --- src/wasm/wasm-validator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm/wasm-validator.cpp') diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index a9a69b244..fad78cefd 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2465,7 +2465,7 @@ void FunctionValidator::visitFunction(Function* curr) { returnTypes.clear(); labelNames.clear(); // validate optional local names - std::set seen; + std::unordered_set seen; for (auto& pair : curr->localNames) { Name name = pair.second; shouldBeTrue(seen.insert(name).second, name, "local names must be unique"); -- cgit v1.2.3