1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

EvalCache AttrKey: Use Symbol instead of std::string

This commit is contained in:
Eelco Dolstra 2022-04-26 14:16:20 +02:00
parent 474695975d
commit b12c33510c
3 changed files with 39 additions and 34 deletions

View file

@ -72,12 +72,14 @@ private:
ChunkedVector<std::string, 8192> store{16};
public:
Symbol create(std::string_view s)
{
// Most symbols are looked up more than once, so we trade off insertion performance
// for lookup performance.
// TODO: could probably be done more efficiently with transparent Hash and Equals
// on the original implementation using unordered_set
// FIXME: make this thread-safe.
auto it = symbols.find(s);
if (it != symbols.end()) return Symbol(it->second.second + 1);