Convert var_table_t to an unordered_map

Profiling revealed string comparison in variable lookups to be a
significant hotspot. This change causes `make test` to complete ~4.5%
faster per `hyperfine`.
This commit is contained in:
Mahmoud Al-Qudsi
2020-06-25 00:46:32 -05:00
parent a5be15da69
commit c3849ebeba
3 changed files with 11 additions and 4 deletions

View File

@@ -635,7 +635,7 @@ std::shared_ptr<const null_terminated_array_t<char>> env_scoped_impl_t::create_e
assert(var && "Variable should be present in uvars");
// Note that std::map::insert does NOT overwrite a value already in the map,
// which we depend on here.
vals.insert(std::make_pair(key, *var));
vals.insert(std::move(std::make_pair(std::move(key), std::move(*var))));
}
}