about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/symbol-table.hh
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-16T21·00+0100
committertazjin <mail@tazj.in>2020-07-16T21·03+0000
commitd470ec0d2946d77b0e4c4b9a0a1e383c0a817167 (patch)
tree832f3e215b4f21438d7bc5f4a8ce08ae7af7e236 /third_party/nix/src/libexpr/symbol-table.hh
parent1b42504a12aa42fbb080c4be1182c3ee9df21fc6 (diff)
refactor(3p/nix/libexpr): Use Abseil collection types for parser state r/1325
Replaces the previous uses of the (ordered!) std::map and std::set
with absl::flat_hash_{map|set}.

After some careful reading it seems that there is actually no
ordering dependency on these types, and the (drop-in) replacements
perform slightly better.

Overall this is not fixing a bottleneck, just a driveby thing.

Change-Id: Ided695dc75676bd58515aa9382df0be0a09c565e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1220
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: isomer <isomer@tvl.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/nix/src/libexpr/symbol-table.hh')
-rw-r--r--third_party/nix/src/libexpr/symbol-table.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/third_party/nix/src/libexpr/symbol-table.hh b/third_party/nix/src/libexpr/symbol-table.hh
index dcb44d32f623..3542f0eadad1 100644
--- a/third_party/nix/src/libexpr/symbol-table.hh
+++ b/third_party/nix/src/libexpr/symbol-table.hh
@@ -26,6 +26,11 @@ class Symbol {
   bool empty() const { return s->empty(); }
 
   friend std::ostream& operator<<(std::ostream& str, const Symbol& sym);
+
+  template <typename H>
+  friend H AbslHashValue(H h, const Symbol& c) {
+    return H::combine(std::move(h), c.s);
+  }
 };
 
 // SymbolTable is a hash-set based symbol-interning mechanism.