aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/symbol-table.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-04-13 14:34:11 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-04-13 14:34:11 +0000
commit816f9c0f6fae0229961bb573dfa0f75ff42c14eb (patch)
tree527a729253e5fa6a393fc1fe9a891d802a12aa7e /src/libexpr/symbol-table.hh
parent7d47498b5ea1ad4685bad954e5407f628f7f5595 (diff)
* Use std::tr1::unordered_set instead of std::set for the symbol
table. This gives a 10% speed increase on `nix-instantiate /etc/nixos/nixos -A system --readonly-mode'.
Diffstat (limited to 'src/libexpr/symbol-table.hh')
-rw-r--r--src/libexpr/symbol-table.hh8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libexpr/symbol-table.hh b/src/libexpr/symbol-table.hh
index ae0751d11..424c23538 100644
--- a/src/libexpr/symbol-table.hh
+++ b/src/libexpr/symbol-table.hh
@@ -2,6 +2,7 @@
#define __SYMBOL_TABLE_H
#include <map>
+#include <tr1/unordered_set>
#include "types.hh"
@@ -59,7 +60,7 @@ inline std::ostream & operator << (std::ostream & str, const Symbol & sym)
class SymbolTable
{
private:
- typedef std::set<string> Symbols;
+ typedef std::tr1::unordered_set<string> Symbols;
Symbols symbols;
public:
@@ -68,6 +69,11 @@ public:
std::pair<Symbols::iterator, bool> res = symbols.insert(s);
return Symbol(&*res.first);
}
+
+ unsigned int size() const
+ {
+ return symbols.size();
+ }
};
}