mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
* 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'.
This commit is contained in:
parent
7d47498b5e
commit
816f9c0f6f
2 changed files with 8 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue