diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/eval.cc | 1 | ||||
-rw-r--r-- | src/libexpr/symbol-table.hh | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index fbd618d4173b..0505c5b2420c 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -1058,6 +1058,7 @@ void EvalState::printStats() printMsg(v, format(" stack space per eval() level: %1% bytes") % ((&x - deepestStack) / (float) maxRecursionDepth)); printMsg(v, format(" values allocated: %1%") % nrValues); printMsg(v, format(" environments allocated: %1%") % nrEnvs); + printMsg(v, format(" symbols in symbol table: %1%") % symbols.size()); } diff --git a/src/libexpr/symbol-table.hh b/src/libexpr/symbol-table.hh index ae0751d11d3c..424c2353899e 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(); + } }; } |